comp.lang.ada
 help / color / mirror / Atom feed
* Expectation of Access Value Equality
@ 2003-09-05 13:35 Nick Roberts
  2003-09-05 13:02 ` chris
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Nick Roberts @ 2003-09-05 13:35 UTC (permalink / raw)


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;

(a) Would you be surprised by:

   Print( (+"foo",+"bar",+"",+"") );

printing three lines?

(b) Would you be surprised by:

   Print( (+"foo",+"bar",+"hum",+"foo") );

printing one line?

(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?)

(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.

I would be very grateful for as many people replying as possible, preferably
in this news group, but privately if you prefer. Thanks.

--
Nick Roberts
E-mail: nickroberts@blueyonder.co.uk
Jabber: debater@charente.de [ICQ: 159718630]






^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-09-23 10:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-05 13:35 Expectation of Access Value Equality Nick Roberts
2003-09-05 13:02 ` chris
2003-09-05 17:56   ` Nick Roberts
2003-09-05 19:10 ` Robert I. Eachus
2003-09-05 19:32 ` Jeffrey Carter
2003-09-05 19:35 ` Simon Wright
2003-09-06  0:25 ` Matthew Heaney
2003-09-06  2:41 ` Steve
2003-09-06 22:01 ` Georg Bauhaus
2003-09-08  9:08 ` Preben Randhol
2003-09-08  9:09   ` Andy
2003-09-09 22:31     ` Nick Roberts
2003-09-10 18:39 ` Mário Amado Alves
2003-09-23 10:46 ` Jacob Sparre Andersen

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