comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Supertypes RE: Extensible Enumerated types
Date: Thu, 01 Feb 2001 03:29:28 GMT
Date: 2001-02-01T03:29:28+00:00	[thread overview]
Message-ID: <3A78D813.D749722F@acm.org> (raw)
In-Reply-To: mailman.980990522.2953.comp.lang.ada@ada.eu.org

"Beard, Frank" wrote:
> I like Jeff Creem's idea of:
> 
> type Fruit_Type is (Apple, Orange);
> type New_Fruit_Type is new Fruit_Type with (Pear, Kiwi);

This seems like an excellent idea. The only difference between this and

type New_Fruit_Type is (Apple, Orange, Pear, Kiwi);

would be type conversions between the types:

F : Fruit_Type     := ...;
N : New_Fruit_Type := ...;

N := New_Fruit_Type (F); -- Always OK
F := Fruit_Type (N);     -- Raises Constraint_Error if N not in
                         -- Apple .. Orange

Are there any technical/implementation issues against this?

-- 
Jeff Carter
"We call your door-opening request a silly thing."
Monty Python & the Holy Grail



  reply	other threads:[~2001-02-01  3:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-01  1:20 Supertypes RE: Extensible Enumerated types Beard, Frank
2001-02-01  3:29 ` Jeffrey Carter [this message]
2001-02-01 23:56   ` Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
2001-01-30 16:17 Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Tucker Taft
2001-01-31  8:05 ` Supertypes RE: Extensible Enumerated types Robert C. Leif, Ph.D.
2001-01-31 15:15   ` Marin David Condic
replies disabled

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