From: "Grein, Christoph" <christoph.grein@eurocopter.com>
Subject: Re: "&" for array versus "&" for Strings
Date: Wed, 9 Oct 2002 07:28:40 +0200 (MET DST)
Date: 2002-10-09T07:28:40+02:00 [thread overview]
Message-ID: <mailman.1034141702.27775.comp.lang.ada@ada.eu.org> (raw)
procedure Array_Test is
type Name_Array is array (Positive range <>) of String (1..6);
procedure Print_Names (Names : Name_Array) is separate;
begin
Print_Names ("Ada " & "Babbel");
Print_Names (string'("Ada ") & string'("Babbel"));
end Array_Test;
> It seems to me that the "&" should resolve to the
> (string, string)-->Name_Array one, even without the "String'(...)"
> qualifications. Apparently, the older compiler resolved it to the wrong
> one, and the newer one can't resolve it (which is an improvement, but
> still a bug).
>
> I'm not surprised that such a bug has never been noticed before. Most
> people don't write code that uses "&" to concatenate two Strings to
> produce something other than String! First, it's confusing (to humans,
> I mean, in addition to compilers). Second, it requires fixed-length
> strings, which is almost never what you want in an array.
I think only the first statement is ambiguous since the compiler is not allowed
to lookk inside the aggregate to see what is is, a string or an array of
strings.
With the second statment, it's clear the aggregates are strings, so it can
resolve the "&" operator to the correct one returning Name_Array. The one
returning String is out because Print_Names does not accept String.
next reply other threads:[~2002-10-09 5:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-09 5:28 Grein, Christoph [this message]
2002-10-09 12:43 ` "&" for array versus "&" for Strings Robert A Duff
2002-10-09 17:38 ` Steven Deller
2002-10-09 19:46 ` Robert A Duff
-- strict thread matches above, loose matches on Subject: below --
2002-10-10 6:28 Grein, Christoph
2002-10-10 7:15 ` Preben Randhol
2002-10-10 4:35 Grein, Christoph
2002-10-10 6:06 ` Preben Randhol
2002-10-09 9:59 Grein, Christoph
[not found] <200210081153.NAA17399@bulgaria.otn.eurocopter.de>
2002-10-08 12:21 ` David C. Hoos, Sr.
2002-10-08 13:56 ` Sergey Koshcheyev
2002-10-08 15:46 ` David C. Hoos
2002-10-08 15:56 ` Preben Randhol
2002-10-08 11:53 Grein, Christoph
2002-10-08 13:46 ` Preben Randhol
2002-10-08 13:49 ` Preben Randhol
2002-10-08 16:41 ` Robert A Duff
2002-10-09 9:35 ` Preben Randhol
2002-10-08 10:57 Preben Randhol
2002-10-14 16:34 ` Eric G. Miller
2002-10-14 17:54 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox