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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dd23af7a2f4f9e7c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-05 19:02:48 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Mutable parameter of a function (long ago was: Re: What evil would happen?) Date: Mon, 5 Jan 2004 21:01:28 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <-MWdnftXl-K1-GqiRVn-hQ@comcast.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:4135 Date: 2004-01-05T21:01:28-06:00 List-Id: "Dmitry A. Kazakov" 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.