comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Discriminated types with default discriminants
Date: Mon, 28 Nov 2005 20:49:32 -0600
Date: 2005-11-28T20:49:32-06:00	[thread overview]
Message-ID: <Jb6dnbzVepVbXRbeRVn-sQ@megapath.net> (raw)
In-Reply-To: 1131062882.814405.147150@g44g2000cwa.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message
news:1131062882.814405.147150@g44g2000cwa.googlegroups.com...
> Robert A Duff wrote:
>
> > > A few compilers will add a level of indirection, and store the
> > > variable-sized stuff elsewhere, reallocating storage when the amount
> > > available is not big enough.
> >
> > It is quite difficult to get the indirect approach to work right.
> > Think about renaming a subcomponent of the thing,
>
> Ummm ... isn't this exactly what's disallowed by 8.5.1(5)?

Yes, it is. Bob is thinking about cases where a non-discriminant component
is moved by the changing of a discriminant. (I know this because he and I
have had this particular discussion repeatedly.) An implementation like that
is bound to fail, IMHO. On the other hand, an implementation like
Janus/Ada's (in which discriminant dependent components are just descriptors
to the actual data) doesn't have this problem. (There is some complication
determining the correct storage pool to use - think about a discriminant
changing assignment on a subprogram parameter - but its not particularly
hard to get right.)

                             Randy.






  reply	other threads:[~2005-11-29  2:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-03 15:50 Discriminated types with default discriminants Maciej Sobczak
2005-11-03 16:06 ` Martin Krischik
2005-11-03 23:10   ` Robert A Duff
2005-11-04  5:01     ` Jeffrey R. Carter
2005-11-03 16:21 ` Ed Falis
2005-11-03 17:28 ` Dmitry A. Kazakov
2005-11-03 18:51 ` Jeffrey R. Carter
2005-11-03 23:08   ` Robert A Duff
2005-11-04  0:08     ` Adam Beneschan
2005-11-29  2:49       ` Randy Brukardt [this message]
2005-12-02 18:22         ` Robert A Duff
2005-11-04  9:18   ` Maciej Sobczak
2005-11-04  3:27 ` Brian May
2005-11-04 13:09   ` Stephen Leake
2005-11-04 17:58   ` Martin Krischik
replies disabled

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