comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Enforcing initialization protocol for protected type
Date: Fri, 11 Sep 2009 11:03:41 +0200
Date: 2009-09-11T11:03:41+02:00	[thread overview]
Message-ID: <7z37lspxbvu5.xk9ag8zcslry$.dlg@40tude.net> (raw)
In-Reply-To: 73fb1051-edf9-43f8-be50-5a2faa866040@s31g2000yqs.googlegroups.com

On Thu, 10 Sep 2009 22:01:17 -0700 (PDT), AdaMagica wrote:

> On 7 Sep., 22:19, Maciej Sobczak <see.my.homep...@gmail.com> wrote:

>> This, however, opens another question: controlled finalization of
>> protected types to release the state object, if it was allocated
>> dynamically. Oops.
> 
> Use an access discriminant of an anonymous type and you will get a
> coextension that is reclaimed automatically when the object goes out
> of scope, see RM 3.10(14.3/2,14.4/2) [or in the newest draft of the
> Amendment 2, (14.1/3,14.4/3), which is a bit clearer].
> 
> See also RM 3.7(1.c/2..1.e/2).

Hmm, what do you mean by that? When the discriminant's type is an anonymous
access it is still declared at the declaration point of the type. It is not
the declaration point of an object. So if the discriminant is obtained by
the allocator new it will not be destroyed when the object leaves the
scope. It will when the type does. If these scopes are different, the
compiler will complain that the type in the allocator has a deeper level.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-09-11  9:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-07 15:15 Enforcing initialization protocol for protected type Maciej Sobczak
2009-09-07 17:01 ` Georg Bauhaus
2009-09-07 20:19   ` Maciej Sobczak
2009-09-10 17:07     ` Georg Bauhaus
2009-09-11  5:01     ` AdaMagica
2009-09-11  9:03       ` Dmitry A. Kazakov [this message]
2009-09-11 15:25         ` AdaMagica
2009-09-11 16:27           ` Dmitry A. Kazakov
2009-09-11 22:24             ` Randy Brukardt
2009-09-12  8:44               ` Dmitry A. Kazakov
2009-09-10 16:39 ` Per Sandberg
2009-09-14 21:15   ` Adam Beneschan
2009-09-15  0:27     ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox