comp.lang.ada
 help / color / mirror / Atom feed
From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: Re: Ambiguous expressions - Help!
Date: Tue, 24 Sep 2013 11:15:35 -0700 (PDT)
Date: 2013-09-24T11:15:35-07:00	[thread overview]
Message-ID: <9afe7143-873f-4ae9-a387-424a9f858827@googlegroups.com> (raw)
In-Reply-To: <L3+qKwCa4cQSFwx2@ada-augusta.demon.co.uk>

On Tuesday, September 24, 2013 12:38:34 PM UTC-5, Mike H wrote:
> package Foo1 is
>    type grid_index_type  is new integer range 0..80;
>    type grid_type is array (grid_index_type range <>) of character;
>    subtype Vector_type is grid_type (0 .. 8);
> ... etc.
> 
> with Foo1;
> package Foo2 is
>    procedure Put_line (Item : in Foo1.Vector_type);
>    procedure Put_line (Item : in string);
> ... etc.
> 
> with Foo1; use Foo1;
> with Foo2;
> procedure Foo3 is
>    Foo_thing : Vector_type;
> begin
> ... etc.
>    Foo2.Put_line (Foo_thing);
> ... etc.
>    Foo2.Put_line ("Something else");
> ... etc.
> end Foo3;
> 
> Compilation of Foo3 raises error messages of the form "ambiguous
> expression (cannot resolve "Put_line")
> 
> I find it hard to believe that the compiler cannot distinguish between a
> string and an array of characters. What am I doing wrong?
> -- 
> Mike

An Ada String *is* an array of characters.  I didn't realize it, but apparently the String constant (in quotes) can be converted automatically into any vector of characters, even those not declared explicitly as "String"s.

--Eryndlia (KK1T)


  reply	other threads:[~2013-09-24 18:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24 17:38 Ambiguous expressions - Help! Mike H
2013-09-24 18:15 ` Eryndlia Mavourneen [this message]
2013-09-24 18:43   ` Adam Beneschan
2013-09-24 20:34     ` Robert A Duff
2013-09-24 18:37 ` Jeffrey Carter
2013-09-24 21:08 ` Georg Bauhaus
2013-09-25  7:14 ` Mike H
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox