comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How do I create an object instance from a tag?
Date: Wed, 19 Feb 2003 12:36:25 -0600
Date: 2003-02-19T12:36:25-06:00	[thread overview]
Message-ID: <v57jj28mmg2r08@corp.supernews.com> (raw)
In-Reply-To: hou65vklhn0burniq4ds2h8feipo6m7su4@4ax.com

"Grein, Christoph"<christoph.grein@eurocopter.com> wrote:
>
>So there are good reasons why there is not yet a solution for this
problem.


The main one is discriminants. Tagged type discriminants never have
defaults. Moreover, you can add discriminants to any extension of a
tagged type, so you never can know if you have any. And, certainly, the
creation of an object with uninitialized discriminants is a no-no.

What you really want to do is force the calling of a particular
constructor function. (That's what T'Class'Input does, after all, with
T'Input being the constructor).

If you have a dispatching constructor "Make", then you want something
like:

    Obj : T'Class := T.Make (<params>) using <tag object>;

But the reviewers thought that special syntax was overkill for this
problem, and no one has been able to come up with any other solution
that really works.

      Randy.





  reply	other threads:[~2003-02-19 18:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-19  9:39 How do I create an object instance from a tag? Grein, Christoph
2003-02-19 13:26 ` Dmitry A. Kazakov
2003-02-19 18:36   ` Randy Brukardt [this message]
2003-02-20  9:15     ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2003-02-17 20:25 Steve
2003-02-18  8:29 ` Dmitry A. Kazakov
2003-02-18 18:14   ` Randy Brukardt
2003-02-19  2:27     ` Steve
2003-02-19  9:18       ` Dmitry A. Kazakov
2003-02-20 15:38 ` Julio Cano
replies disabled

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