comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Concatenate enumeration
Date: Thu, 26 Nov 2009 09:59:48 +0100
Date: 2009-11-26T09:59:48+01:00	[thread overview]
Message-ID: <eayrakxg11ot$.u7aknwy6xxh6.dlg@40tude.net> (raw)
In-Reply-To: hekcgj$d7e$1@munin.nbi.dk

On Wed, 25 Nov 2009 16:53:07 -0600, Randy Brukardt wrote:

> "Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
> news:wcctywksu8t.fsf@shell01.TheWorld.com...
> ...
>>> You can't. Enumeration types are not extensible.
>>
>> Extensible enumeration types were proposed for Ada 9X,
>> but were dropped.
> 
> And were proposed again for Ada 2005, and were dropped again. See 
> AI95-0261-1. I doubt it will ever be proposed again.

These are different things. I think the OP didn't want an extensible type.
He wanted a new independent type constructed in some specific way.

To extend an enumeration type E that has to have the class (E'Class). This
is a lot of work.

To reuse names of the literals of E in some other type, you only need
reflection. E.g. an attribute, say, E'Domain, which would return
"universal-set" of its literals, then you could write:

   type E is (None, Ready);
   type E1 is E'Domain or (Off); -- = (None, Ready, Off)

Not very useful, but in other cases reflection could be very interesting.
For example, in generics:

   generic
      type T is array; -- Only this
   package ... is
      -- The [first] array index type would be T'Index (1)
      -- The array element type would be T'Element etc

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



  reply	other threads:[~2009-11-26  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 18:15 Concatenate enumeration Pablo
2009-11-23 19:14 ` Jeffrey R. Carter
2009-11-23 23:21   ` Robert A Duff
2009-11-25 22:53     ` Randy Brukardt
2009-11-26  8:59       ` Dmitry A. Kazakov [this message]
2009-11-26  9:48         ` Georg Bauhaus
2009-11-26 10:03           ` Dmitry A. Kazakov
2009-11-24 19:42 ` Eryndlia Mavourneen
  -- strict thread matches above, loose matches on Subject: below --
2010-10-22 19:49 okellogg
2010-10-26  0:29 ` Yannick Duchêne (Hibou57)
2010-11-12 17:55 ` Randy Brukardt
replies disabled

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