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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6a0391eb7e0327d5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-08 21:58:30 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!151.164.30.35!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Ada style of passing 'in' parameters considered dangerous? Date: Sat, 08 Feb 2003 22:07:38 -0800 Organization: AdaWorks Software Engineering Message-ID: <3E45F02A.497A7DDB@adaworks.com> References: <86isvuzabx.fsf@hoastest1-8c.hoasnet.inet.fi> Reply-To: richard@adaworks.com NNTP-Posting-Host: 3f.bb.a1.92 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 9 Feb 2003 05:58:29 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:33929 Date: 2003-02-09T05:58:29+00:00 List-Id: Robert A Duff wrote: > How about this example: > > We have a record representing fractions of whole numbers: > > type Fraction is > record > Numerator: Integer; > Denominator: Positive; > end record; > > procedure Reciprocal(Result: out Fraction; X: Fraction); > -- Sets Result to the reciprocal of X. > > procedure Reciprocal(Result: out Fraction; X: Fraction) is > begin > if X.Numerator > 0 then > Result.Numerator := X.Denominator; > Result.Denominator := X.Numerator; > ... etc > > It seems reasonable (without seeing the body of Reciprocal) to do: > > Reciprocal(Foo, Foo); Interesting example. A little bit of a stretch since it would rarely occur in practice. However, it is one reason why I proposed, a few years ago that we add a mode based on the reserved word constant. In particular, I would like to be able to use that reserved word anywhere we normally would be allowed to use access. Your example suggests it might be useful under other circumstances as well. Richard Riehle