comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Concatenate enumeration
Date: Mon, 23 Nov 2009 12:14:27 -0700
Date: 2009-11-23T12:14:27-07:00	[thread overview]
Message-ID: <heemov$1se$1@news.tornevall.net> (raw)
In-Reply-To: <be502fa4-37e4-47c0-a0ba-1618eee9a35e@1g2000vbm.googlegroups.com>

Pablo wrote:
> type Enumerate_Type is
>   (
>    NONE,
>    READY
>   );
> for Enumerate_Type use
>   (
>    NONE  => 0,
>    READY=> 1
>   );
> for Enumerate_Type'Size use 1;
> 
> and I want to create a new type Enumerate2_Type which could be the
> form
> type Enumerate_Type is
>   (
>    NONE,
>    READY,
>    OFF
>   );
> for Enumerate_Type use
>   (
>    NONE  => 0,
>    READY=> 1,
>    OFF     => 2
>   );
> for Enumerate_Type'Size use 2;
> 
> How to I do this without having to explicit clone the first one?

You can't. Enumeration types are not extensible.

You can do something similar in the reverse direction:

type Big is (None, Ready, Off);

subtype Small is Big range None .. Ready;

or

type Small is new Big range None .. Ready;

-- 
Jeff Carter
"Monsieur Arthur King, who has the brain of a duck, you know."
Monty Python & the Holy Grail
09



  reply	other threads:[~2009-11-23 19:14 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 [this message]
2009-11-23 23:21   ` Robert A Duff
2009-11-25 22:53     ` Randy Brukardt
2009-11-26  8:59       ` Dmitry A. Kazakov
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