comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Dynamic type system for Ada
Date: Tue, 24 Jan 2017 15:21:41 -0600
Date: 2017-01-24T15:21:41-06:00	[thread overview]
Message-ID: <o68gh6$k9d$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: o67mi7$v0f$1@gioia.aioe.org

"Victor Porton" <porton@narod.ru> wrote in message 
news:o67mi7$v0f$1@gioia.aioe.org...
...
> 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).
>
> 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).

I'd suggest that it be defined as an abstract tagged type, with each of the 
other kinds of things as a derived tagged type (one for holding integers, 
one for holding floats, etc.). Then one could get a "variable that could 
hold anything" by instantiating the Unbounded_Holder container (and that 
would open uses of the other kinds of containers as well). That way, the 
package wouldn't have to reinvent all of the memory management stuff that's 
already in the containers. Plus, if one organized the hierarchy similar to 
the chart in 3.2(12) 
[http://www.ada-auth.org/standards/2xrm/html/RM-3-2.html#p12], you could 
define shared operations at the appropriate levels to have some use beyond 
just plain storage. (For instance, all of the numeric types would have math 
this way.)

I do wonder how useful such a hierarchy would be, but I suppose someone 
would have to build it to find out.

                                   Randy.


  parent reply	other threads:[~2017-01-24 21:21 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
2017-01-24 18:07     ` Jeffrey R. Carter
2017-01-24 21:21     ` Randy Brukardt [this message]
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