From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Discriminant of a limited type object
Date: Tue, 27 Feb 2018 16:20:21 -0600
Date: 2018-02-27T16:20:21-06:00 [thread overview]
Message-ID: <p74lj6$ls3$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: p745vr$pma$1@gioia.aioe.org
A defaulted discriminant for a limited type means just that: a default for
the discriminant if the object is default initialized. It was always a
mistake for Ada to tie that to mutability, but it doesn't matter for a
limited type.
You can initialize an array of limited discriminanted objects with an
aggregate of function calls (since those are built-in-place), and they can
all have different discriminant values.
The "hole" is that you can't assign discriminants to tasks/protected objects
easily, because there is no aggregate for them. You could use access-to-task
to do that, but of course then you get the normal access type issues.
Supposedly, you could use an aggregate iterator to do that, but I'm not sure
how (perhaps there is a way with a nested record?)
Randy.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:p745vr$pma$1@gioia.aioe.org...
> Never needed that, but it seems that there no way to change the
> discriminant of a definite object of limited type because there is no
> assignment.
>
> Say, we have an array of limited variant records with a defaulted
> discriminant. Then there is no way to fill that array ever, because
> element's discriminants are frozen.
>
> P.S. Yet another example why Ada needs proper constructors instead of
> limited returns...
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-02-27 22:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 17:54 Discriminant of a limited type object Dmitry A. Kazakov
2018-02-27 22:20 ` Randy Brukardt [this message]
2018-02-27 22:53 ` Dmitry A. Kazakov
2018-02-28 6:36 ` J-P. Rosen
2018-02-28 8:42 ` Dmitry A. Kazakov
2018-02-28 9:07 ` J-P. Rosen
2018-02-28 17:16 ` Jeffrey R. Carter
2018-02-28 23:10 ` Randy Brukardt
2018-03-01 8:43 ` Dmitry A. Kazakov
2018-03-01 22:00 ` Randy Brukardt
2018-03-02 10:30 ` 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