comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Re: derived formal types and known discriminants
Date: Mon, 3 Jul 2017 17:30:26 -0700 (PDT)
Date: 2017-07-03T17:30:26-07:00	[thread overview]
Message-ID: <a1bd4695-00ff-49a8-a07a-84ebdb043202@googlegroups.com> (raw)
In-Reply-To: <oj645n$iq3$1@franka.jacob-sparre.dk>

On Friday, June 30, 2017 at 2:10:01 PM UTC-4, Randy Brukardt wrote:
> 
> Sure, but they're very inflexible in that usage (as bad or worse than the 
> original unconstrained types). So I tend to view these as an either/or 
> proposition: untagged, mutable types with discriminants, or tagged types 
> without discriminants. Again, YMMV.
> 


At the risk of having some of the other thread's shade thrown in here, aren't tagged discriminated records the de facto way of doing initialization?  That is, extending a Controlled type and then using discriminants in place of ctor arguments?  I can see that a "real" discriminated record (i.e. variant records) probably have little use in a tagged hierarchy, but access discriminants (et al) seem much closer to 'constant record elements' than a truly discriminated record.

After all, how else is one supposed to do construction for an abstract parent type?  In C++, for example, an abstract type still has a constructor (that all children would have to explicitly call with the required arguments), but in Ada 'constructing functions' are off the table since the type is abstract.  So apparently the only thing left is to use Initialize and then ferry any required arguments over as discriminants?  This is the method given in many texts and examples, so please set me straight if i'm way off base.

Thank you again to everyone for the helpful comments and continued support.

-sb


  reply	other threads:[~2017-07-04  0:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  0:45 derived formal types and known discriminants sbelmont700
2017-06-23 17:26 ` Randy Brukardt
2017-06-29 14:15   ` sbelmont700
2017-06-29 14:39     ` Dmitry A. Kazakov
2017-06-29 17:40       ` Robert Eachus
2017-06-30  1:10     ` Randy Brukardt
2017-06-30  7:24       ` Dmitry A. Kazakov
2017-06-30 18:09         ` Randy Brukardt
2017-07-04  0:30           ` sbelmont700 [this message]
2017-07-04  1:36             ` gautier_niouzes
2017-07-04  2:29             ` Randy Brukardt
2017-07-04  7:09             ` Dmitry A. Kazakov
2017-07-04 17:34               ` Shark8
2017-07-03 17:24 ` Jere
replies disabled

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