comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: creating an array
Date: Wed, 15 Feb 2006 14:30:40 +0100
Date: 2006-02-15T14:30:40+01:00	[thread overview]
Message-ID: <14iyyw73rt5i8$.1fkeh9i1mlj3e$.dlg@40tude.net> (raw)
In-Reply-To: dsum0h$nnd$1@sunnews.cern.ch

On Wed, 15 Feb 2006 08:42:09 +0100, Maciej Sobczak wrote:

> Dmitry A. Kazakov wrote:
> 
>>>for Index in The_Array_Type'Range loop
>>>    The_Array(Index) := The_Function;
>>>end loop;
>> 
>> The_Array_Type := (others => The_Function);
>             ^^^^^
> Rather The_Array := ...

Yes, of course.
 
> But what's more important - could you point to a specific paragraph in 
> AARM that guarantees that the two above are equivalent? I mean - is it 
> guaranteed that (others=>The_Function) has the meaning of increasing 
> order of indexes? Is is possible for the implementation to call 
> The_Function just once and reuse its return value for all elements' 
> assignments?

Jean-Pierre has answered this.

Functions shouldn't have side effects relevant to the call context. So the
result of The_Function should be independent on Index. It shouldn't read a
stream, but it can call to random generator, it can create a new object, it
can start a task etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2006-02-15 13:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-14  6:06 creating an array isaac2004
2006-02-14 13:59 ` jimmaureenrogers
2006-02-14 15:20   ` isaac2004
2006-02-14 18:44     ` jimmaureenrogers
2006-02-14 19:25 ` Björn Persson
2006-02-14 19:39   ` Dmitry A. Kazakov
2006-02-14 21:14     ` isaac2004
2006-02-14 22:17       ` jimmaureenrogers
2006-02-14 22:30         ` isaac2004
2006-02-14 22:45         ` Ludovic Brenta
2006-02-14 22:54           ` isaac2004
2006-02-14 23:10             ` Ludovic Brenta
2006-02-14 23:37               ` isaac2004
2006-02-15  7:45                 ` Anders Wirzenius
2006-02-15 20:44                   ` Björn Persson
2006-02-16  6:59                     ` Anders Wirzenius
2006-02-15 21:53                 ` Ludovic Brenta
2006-02-15 23:29                   ` isaac2004
2006-02-16  3:09                     ` jimmaureenrogers
2006-02-15  7:42     ` Maciej Sobczak
2006-02-15 10:37       ` Jean-Pierre Rosen
2006-02-15 13:30       ` Dmitry A. Kazakov [this message]
2006-02-15 16:23         ` isaac2004
replies disabled

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