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 Path: g2news2.google.com!postnews.google.com!a18g2000yqc.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Ensuring postconditions in the face of exceptions Date: Mon, 15 Mar 2010 10:33:12 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2e29400d-9fe2-467f-8858-f88f79cd4caf@a18g2000yqc.googlegroups.com> 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: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1268674392 15341 127.0.0.1 (15 Mar 2010 17:33:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Mar 2010 17:33:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a18g2000yqc.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:10548 Date: 2010-03-15T10:33:12-07:00 List-Id: Robert A Duff wrote on comp.lang.ada: > 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. =A0So how about: > > =A0 =A0 type Cache is limited > =A0 =A0 =A0 =A0 record > =A0 =A0 =A0 =A0 =A0 =A0 X : T; > =A0 =A0 =A0 =A0 =A0 =A0 Dirty : Boolean :=3D True; > =A0 =A0 =A0 =A0 end record; > =A0 =A0 type Cache_Ref is access all Cache; > > and pass a parameter of type Cache_Ref? =A0(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. =A0So 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. Yes, that's the solution I have, currently, i.e. (5); except that the Cache type already existed before, has other unrelated components and is not limited. -- Ludovic Brenta.