comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Why no abstract non-tagged types?
Date: Fri, 21 Feb 2014 09:33:41 +0100
Date: 2014-02-21T09:33:41+01:00	[thread overview]
Message-ID: <rfovrp7433ff$.1pcytc3702k9d.dlg@40tude.net> (raw)
In-Reply-To: 90153ba2-ffe8-4696-8459-d81a0f703c9e@googlegroups.com

On Thu, 20 Feb 2014 19:04:08 -0800 (PST), Britt wrote:

> Recently I've been wishing I could declare some otherwise conventional
> enumeration types as "abstract" so they could only be used as a template
> for derived types.

Abstract enumeration is a different thing. That is when elements of the
enumeration are abstract primitive operations as well as T'Pos, T'Val etc
to be defined by derived implementation types.

> Such abstract types couldn't be used directly for object declarations.  For example:
> 
>    type Valve_State_Base_Type is abstract (Unknown, Open, Closed);  -- in Ada 202X

Why not:

   type Valve_State_Base_Type is [abstract] private;  -- Legal Ada
[  function Unknown return Valve_State_Base_Type is abstract;
   function Open return Valve_State_Base_Type is abstract;
   function Closed return Valve_State_Base_Type is abstract; ]

>    type Vent_Valve_State_Type is new Valve_State_Base_Type;  -- a legal derivation

Classes of scalar and by-value types is my no.1 wish for Ada 20XX. That
would cover enumerations as well.

It will never happen, I am afraid.

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


  reply	other threads:[~2014-02-21  8:33 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 [this message]
2014-02-26 18:52   ` Dan'l Miller
2014-02-26 20:55     ` Dmitry A. Kazakov
2014-02-26 21:40     ` Eryndlia Mavourneen
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