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,ce0900b60ca3f616 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-10 14:27:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BEDA9C2.3FB191B7@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Better control of assignment References: <9rti6v$hcu$1@news.huji.ac.il> <9sdnb2$dd4$1@news.huji.ac.il> <9seup3$12h0ar$2@ID-25716.news.dfncis.de> <3BEC12BA.E72A81EC@boeing.com> <9sib24$13aeg3$2@ID-25716.news.dfncis.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 10 Nov 2001 22:27:25 GMT NNTP-Posting-Host: 209.86.204.165 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1005431245 209.86.204.165 (Sat, 10 Nov 2001 14:27:25 PST) NNTP-Posting-Date: Sat, 10 Nov 2001 14:27:25 PST Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Sat, 10 Nov 2001 14:23:14 PST (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:16252 Date: 2001-11-10T22:27:25+00:00 List-Id: Nick Roberts wrote: > > "Jeffrey Carter" wrote in message > > Assignment should not be able to modify the RHS, especially as it may be > > an expression, not a variable. > > Perhaps the name Assign is wrong. Maybe Copy would be better. To my mind, it > seems obvious (of course ;-) that if the RHS is a constant, this procedure > is not invoked; it is only invoked for a copy (including parameter passing > by copy (if selected)) from one variable object of type T to another. If > this does not deliver enough control, you must make the type private. For > example: > > type Odd_Counter is new Integer; > procedure Assign_Odd (Src, Tgt: in out Odd_Counter); > for Odd_Counter'Copy use Assign_Odd; > ... > procedure Assign_Odd (Src, Tgt: in out Odd_Counter) is > begin > if not Is_Odd(Src) then > raise Oddness_Error; > else > Tgt := Src; -- inherited assignment used here by a language rule > end if; > end; There is still no need for Src to be mode in out. -- Jeff Carter "Son of a window-dresser." Monty Python & the Holy Grail