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-Thread: 103376,c80e6f742e73478f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ensuring postconditions in the face of exceptions Date: Mon, 15 Mar 2010 12:44:25 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <820d96c0-5d67-4b8c-8c5b-811ca4f1127e@g26g2000yqn.googlegroups.com> <8990d686-f703-4e9c-91b7-32410289983d@g11g2000yqe.googlegroups.com> <87ljdv56gy.fsf@ludovic-brenta.org> <22728d81-9ede-4128-ab47-eacec75f6954@r27g2000yqn.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1268671455 15025 192.74.137.71 (15 Mar 2010 16:44:15 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 15 Mar 2010 16:44:15 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:n6ByNwe02bYe7quMygOFj4mnSZQ= Xref: g2news2.google.com comp.lang.ada:10547 Date: 2010-03-15T12:44:25-04:00 List-Id: Ludovic Brenta writes: > No, Dirty is not a property of the object; the type T is used in > several places, only some of which (a one-line cache, essentially) has > a Dirty property. OK, then Dirty is a property of the cache. So how about: type Cache is limited record X : T; Dirty : Boolean := True; end record; type Cache_Ref is access all Cache; and pass a parameter of type Cache_Ref? (Or perhaps X could be an access type, and point to the T object.) You need to pass some sort of pointer, explicitly or implicitly, because when you raise an exception, the copy-back is skipped. You said that relying on limitedness to force pass-by-referrence is confusing -- I agree. So pass an explicit pointer. I recommend a named access type, because anonymous access parameters have dynamic accessibility, which is a tripping hazard, and is less efficient. - Bob