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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,42fb0a5ae1751a1e X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Q Controlled Types Date: 1997/06/14 Message-ID: #1/1 X-Deja-AN: 248348906 References: <5ns30g$9ui@news.Informatik.Uni-Oldenburg.DE> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-06-14T00:00:00+00:00 List-Id: In article <5ns30g$9ui@news.Informatik.Uni-Oldenburg.DE>, Guido Schumacher wrote: >My intention is to preserve information of a target object in an >assignment. The information (containing a protected object) is stored >in an object which can be accessed by an access type. A pointer of >that access type is a record component of the controlled type. If it >were obvious that a call of finalize is not part of an assignment it >would be possible to deallocate the object containing the static >information. The controlled object and the static object would both >have the same lifetime. Ada's controlled types can't do that directly. Instead, you probably want to declare a limited controlled type with two components: the pointer you want to preserve, plus a non-limited (maybe controlled?) component containing all the other stuff. Do your assignments on that second component. Finalize of that (if it's needed at all) can do whatever you need it to do, and Finalize of the outer (limited) thing can deallocate the protected object pointed at by the pointer. - Bob