From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Dynamic type system for Ada
Date: Tue, 24 Jan 2017 15:26:13 +0100
Date: 2017-01-24T15:26:13+01:00 [thread overview]
Message-ID: <o67o64$12a0$1@gioia.aioe.org> (raw)
In-Reply-To: o67mi7$v0f$1@gioia.aioe.org
On 24/01/2017 14:58, Victor Porton wrote:
> It seems that you didn't understood me.
You should have asked about data definition layer, not type then. Types
have operations.
> All I ask is just an Ada type which would be so flexible that could store
> any kind of a value (just like as a variable in a dynamic language).
Task value, protected object value, a value from generic instance not
yet instantiated, subprogram value?
In languages you have in mind there are types which can be used that way
and not-so-much-types which cannot.
> This type could be a variant record which could store numbers, lists/arrays,
> strings, etc. (anything that can be stored in a variable in a dynamic
> language).
Then you should have asked about a variant type of some predefined set
of scalar types and predefined class of containers. It has little use in
Ada.
As an implementation consider stream attributes. For a stream take a
memory-located stream. Yes it is implemented in Ada. It has almost no
use because Ada lacks things I listed. You cannot hang an interface on a
stream object in order to access the object stored in the stream in the
same way the original type is accessed (AKA dynamic cast, AKA
polymorphic object). For this the stream object must inherit the
interface of the type it contains, and do that ad-hoc. Variant record
types do the job (dynamic cast is performed by variant selection per
discriminant), but they are very very limited in what they can do.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2017-01-24 14:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 13:12 Dynamic type system for Ada Victor Porton
2017-01-24 13:44 ` Dmitry A. Kazakov
2017-01-24 13:58 ` Victor Porton
2017-01-24 14:26 ` Dmitry A. Kazakov [this message]
2017-01-24 18:07 ` Jeffrey R. Carter
2017-01-24 21:21 ` Randy Brukardt
2017-01-24 22:01 ` J-P. Rosen
2017-01-25 8:23 ` Dmitry A. Kazakov
2017-01-25 21:55 ` Randy Brukardt
2017-01-25 8:38 ` Georg Bauhaus
2017-01-25 5:41 ` Paul Rubin
2017-01-27 19:20 ` Victor Porton
2017-01-28 1:16 ` Dennis Lee Bieber
2017-01-28 9:37 ` Jeffrey R. Carter
2017-01-26 17:53 ` Vincent
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox