From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5037bf0bb33408c8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-08 22:35:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: "&" for array versus "&" for Strings Date: Wed, 9 Oct 2002 07:28:40 +0200 (MET DST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1034141702 86277 137.194.161.2 (9 Oct 2002 05:35:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 9 Oct 2002 05:35:02 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: QUH7FqMCZE0FoeMFjTwS6g== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:29604 Date: 2002-10-09T07:28:40+02:00 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.