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.9 required=5.0 tests=BAYES_00,WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,90514f9a192a4997 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-05 12:36:45 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Expectation of Access Value Equality Date: 05 Sep 2003 20:35:06 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1062790604 17327 62.49.19.209 (5 Sep 2003 19:36:44 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Fri, 5 Sep 2003 19:36:44 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:42191 Date: 2003-09-05T20:35:06+01:00 List-Id: "Nick Roberts" writes: > I'm asking for the help of Ada programmers of all levels of experience. > > Given the following declarations: > > type A_String is access constant String; > > function "+" (S: String) return A_String is > begin > return new String'(S); > end; > > type A_String_Array is array (Positive range <>) of String; > > procedure Print (A: in A_String_Array) is > Sentinel: constant A_String := A(A'Last); > Current: Positive := A'First; > begin > loop > Put_Line( A(Current).all ); > exit when A(Current) = Sentinel; > Current := Current + 1; > end loop; > end; That is a pretty bizarre piece of code! (E&OE). I guess there might be circumstances in which the part at issue was the right thing to do .. > (a) Would you be surprised by: > > Print( (+"foo",+"bar",+"",+"") ); > > printing three lines? yes > (b) Would you be surprised by: > > Print( (+"foo",+"bar",+"hum",+"foo") ); > > printing one line? yes > (c) What would you think of an implementation that caused this behaviour? > (What would you think of an implementation that printed four lines in both > cases?) odd, needs study (ok) > (d) I'd be grateful for a very brief indication of your level and broad > area(s) of programming experience, in Ada and other languages. expert user, not language lawyer would be surprised by the same behaviours in C otherwise tend to use scripting languages so question doesn't arise If an amended ARM said the surprising behaviours were OK I would not be concerned, plenty of other implementation-defined stuff to avoid in the language!