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,9e5138de1ea5afeb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-27 03:43:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feeder.qis.net!btnet-peer!btnet!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!news!not-for-mail From: Nige Newsgroups: comp.lang.ada Subject: Re: Using controlled types to trace program execution Date: Wed, 27 Feb 2002 11:44:45 +0000 Organization: Thales Message-ID: <3C7CC6AD.493A1E54@uk.thalesgroup.com> References: <3C7B9007.FB5F257D@uk.thalesgroup.com> NNTP-Posting-Host: sswc014.int.rdel.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: rdel.co.uk 1014810184 9901 172.16.10.25 (27 Feb 2002 11:43:04 GMT) X-Complaints-To: postmaster@uk.thalesgroup.com NNTP-Posting-Date: 27 Feb 2002 11:43:04 GMT X-Mailer: Mozilla 4.77 [en] (X11; U; SunOS 5.6 sun4m) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:20509 Date: 2002-02-27T11:43:04+00:00 List-Id: tmoran@acm.org wrote: > A combination will do the job. > You can't pass a string as a discriminant to your controlled type, and if > you pass an access-to-string type it will be a constant and you won't > be able to "free" the string. But you can do it with two levels: > type p is access string; > type t(msg : access p) is new ada.finalization.limited_controlled with ... > Then use the generic instantiation as a shorthand for declaring an > aliased pointer to a new string'("something") followed by a declaration > of the controlled type with a 'access to that pointer as its parameter. Thanks - I hadn't thought about declaring a package - only a variable. Nige