comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Construction initialization problem
Date: Fri, 5 Dec 2008 19:47:53 -0600
Date: 2008-12-05T19:47:53-06:00	[thread overview]
Message-ID: <ghcllc$2rb$1@munin.nbi.dk> (raw)
In-Reply-To: b5578996-6595-499c-8031-3bfae82a6070@s9g2000prm.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message 
news:b5578996-6595-499c-8031-3bfae82a6070@s9g2000prm.googlegroups.com...
...
> I thought access discriminants---at least those with anonymous access
> type---were put into Ada 95 (before there were coextensions) to allow
> objects to point to other objects in a nested scope, in a restricted
> way (i.e. only in limited types) that prevented those references to a
> nested objects from staying around after the nested object
> disappeared.

There always were coextensions in Ada 95; they just didn't have that name.

You might be right about the original reason, but like everything else about 
anonymous access types, it doesn't work in practice. Best thing to do with 
them is to forget that they exist.

> I wasn't aware that there were enough new features in
> Ada 2005 to provide this ability without using access discriminants.
> So what am I missing?

I don't think this capability is (usefully) provided in Ada 95, either, 
because you don't want these things to be discriminants - that triggers all 
kinds of other rules (such as the requirement to use full record aggregates) 
that get in the way more than help. Coextensions probably are the only way 
to do this usefully, but they're very complex to implement and understand, 
and people don't use them anyway because they *look* like dynamic allocation 
(even though they are not supposed to be implemented that way).

This is the sort of thing that looks good in toy examples, but falls apart 
when you actually try to use it (as Dmitry noted in his original question).

                                                                  Randy.





  reply	other threads:[~2008-12-06  1:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04 16:08 Construction initialization problem Dmitry A. Kazakov
2008-12-04 17:35 ` Adam Beneschan
2008-12-04 22:17 ` Randy Brukardt
2008-12-04 23:02   ` Adam Beneschan
2008-12-06  1:47     ` Randy Brukardt [this message]
2008-12-05  9:00   ` Dmitry A. Kazakov
2008-12-06  1:42     ` Randy Brukardt
2008-12-06 10:16       ` Dmitry A. Kazakov
replies disabled

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