From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Mutable parameter of a function (long ago was: Re: What evil would happen?)
Date: Mon, 5 Jan 2004 21:01:28 -0600
Date: 2004-01-05T21:01:28-06:00 [thread overview]
Message-ID: <vvk9aag0tpob52@corp.supernews.com> (raw)
In-Reply-To: bt8vap$455n1$1@ID-77047.news.uni-berlin.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:bt8vap$455n1$1@ID-77047.news.uni-berlin.de...
...
> The point is that the code reader should see that the random generator is
> not a pure function of its argument. This has to be seen immediately from
> the specifications, not from a speculation "how-I-would-implement-that".
> This is why either the parameter has to be an access or an in-out.
Anything
> other is wrong, IMO. Similarly the way the operations on File_Type were
> declared is IMO wrong!
You're probably right, but that isn't the model of Ada.
In parameters and constants just provide a constant view of an object. But
nearly every object has a variable view as well -- you just can't explicitly
name it. Initialization and finalization are always done on a variable view
of the object - even if it is declared as a constant.
That will be more obvious in Ada 200Y, because of the ability to initialize
limited objects. A constant of a limited type might contain a task;
certainly that task will run and modify its local objects without any regard
to whether it is declared in a constant or variable. The task will have a
variable view of its containing object, even if the program as a whole only
has a constant view of the object.
Randy.
next prev parent reply other threads:[~2004-01-06 3:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-02 17:55 Mutable parameter of a function (long ago was: Re: What evil would happen?) Alexandre E. Kopilovitch
2004-01-03 1:56 ` Robert I. Eachus
2004-01-03 11:18 ` Dmitry A. Kazakov
2004-01-04 0:58 ` Robert I. Eachus
2004-01-04 12:07 ` Dmitry A. Kazakov
2004-01-05 3:17 ` Alexandre E. Kopilovitch
2004-01-05 9:55 ` Dmitry A. Kazakov
2004-01-05 16:19 ` Robert I. Eachus
2004-01-06 3:04 ` Randy Brukardt
2004-01-06 9:32 ` Dmitry A. Kazakov
2004-01-06 3:01 ` Randy Brukardt [this message]
2004-01-06 9:26 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox