comp.lang.ada
 help / color / mirror / Atom feed
From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: Re: Why no abstract non-tagged types?
Date: Wed, 26 Feb 2014 13:40:17 -0800 (PST)
Date: 2014-02-26T13:40:17-08:00	[thread overview]
Message-ID: <ca8cf9fc-6986-4de7-ba88-f2a0654c959b@googlegroups.com> (raw)
In-Reply-To: <2e5f406d-3fd1-4f8b-a1dd-c0c2a196cc94@googlegroups.com>

On Wednesday, February 26, 2014 12:52:31 PM UTC-6, Dan'l Miller wrote:
> Please give some Ada202X mock-up of precisely what by-value types and scalar classes would wisely enable that are inexpressible throughout Ada2012.

Would something like the following work for you?

    package Abstract_Color is
       type Color is (Red, Green, Blue);
       package Literal is
          function Red   return Color is abstract;
          function Green return Color is abstract;
          function Blue  return Color is abstract;
       end Literal;
    end Abstract_Color;

Then, you can reference Abstract_Color.Literal.Red, etc.

You also can make it generic, as Shark suggested.


  parent reply	other threads:[~2014-02-26 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21  3:04 Why no abstract non-tagged types? Britt
2014-02-21  8:33 ` Dmitry A. Kazakov
2014-02-26 18:52   ` Dan'l Miller
2014-02-26 20:55     ` Dmitry A. Kazakov
2014-02-26 21:40     ` Eryndlia Mavourneen [this message]
2014-02-24 23:12 ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox