From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Dynamic type system for Ada Date: Tue, 24 Jan 2017 15:21:41 -0600 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1485292902 20781 24.196.82.226 (24 Jan 2017 21:21:42 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 24 Jan 2017 21:21:42 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:33147 Date: 2017-01-24T15:21:41-06:00 List-Id: "Victor Porton" 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.