comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Dynamic type system for Ada
Date: Wed, 25 Jan 2017 09:23:24 +0100
Date: 2017-01-25T09:23:24+01:00	[thread overview]
Message-ID: <o69n9s$ogk$1@gioia.aioe.org> (raw)
In-Reply-To: o68gh6$k9d$1@franka.jacob-sparre.dk

On 24/01/2017 22:21, Randy Brukardt wrote:

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

Not much. I did exactly this before.

The problem is that you get the "god-class" in the end. In order to be 
able to re-interpret the value as a given scalar type you have to add a 
primitive operation to the abstract base. E.g.

    function As_Unsigned_32 (Value : Abstract_Variable)
       return Unsigned_32 is abstract;
          -- Raises Type_Error if not of the type

And so for each scalar type. And for arrays and records.

Otherwise you have to explicitly convert (upcast) to specific instance 
derived from Abstract_Variable which is much worse.

P.S. I intended to use that on top of a stream exchange, but the 
interface is so heavy that it adds no advantage to direct reading the 
target object from the stream.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2017-01-25  8:23 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
2017-01-24 22:01       ` J-P. Rosen
2017-01-25  8:23       ` Dmitry A. Kazakov [this message]
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