comp.lang.ada
 help / color / mirror / Atom feed
* Supertypes RE: Extensible Enumerated types
  2001-01-30 16:17 Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Tucker Taft
@ 2001-01-31  8:05 ` Robert C. Leif, Ph.D.
  2001-01-31 15:15   ` Marin David Condic
  0 siblings, 1 reply; 5+ messages in thread
From: Robert C. Leif, Ph.D. @ 2001-01-31  8:05 UTC (permalink / raw)
  To: comp.lang.ada

From: Bob Leif
To: My fellow Ada users

This is suggestion includes the addition of a new keyword to Ada. I realize
that some would consider this rank heresy.

Since Ada has Subtypes to specify a subset of a type, it would be reasonable
to create a symmetrical operation to create a superset of a type.

-- from Package Prefix_Recs
type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev,
    Other);

--From Package Prefix_Recs.Army
Supertype Army_Prefix_Type is (Prefix_Type, Private, Corporal, Sergeant,
Lieutenant, Captain, Major, Colonel, General);

Prefix_Type'range would also be a possibility.

Army_Prefix_Type would inherit all of the operations of Prefix_Type.

I believe that super is lexicography a better choice than supra. I must add
that supertypes are appropriate for a super language.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Supertypes RE: Extensible Enumerated types
  2001-01-31  8:05 ` Supertypes RE: Extensible Enumerated types Robert C. Leif, Ph.D.
@ 2001-01-31 15:15   ` Marin David Condic
  0 siblings, 0 replies; 5+ messages in thread
From: Marin David Condic @ 2001-01-31 15:15 UTC (permalink / raw)


I could see that as interesting - sort of building onto type extension. There
may be issues with representation that need to be looked at, do you think? I
guess my only reservation would be that it needs to be asked how generally
useful is this? Would it enable some significant new technique that would get
used often enough to make it worth disturbing the reserved word list?

MDC

Robert C. Leif, Ph.D. wrote:

> From: Bob Leif
> To: My fellow Ada users
>
> This is suggestion includes the addition of a new keyword to Ada. I realize
> that some would consider this rank heresy.
>
> Since Ada has Subtypes to specify a subset of a type, it would be reasonable
> to create a symmetrical operation to create a superset of a type.
>
> -- from Package Prefix_Recs
> type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev,
>     Other);
>
> --From Package Prefix_Recs.Army
> Supertype Army_Prefix_Type is (Prefix_Type, Private, Corporal, Sergeant,
> Lieutenant, Captain, Major, Colonel, General);
>
> Prefix_Type'range would also be a possibility.
>
> Army_Prefix_Type would inherit all of the operations of Prefix_Type.
>
> I believe that super is lexicography a better choice than supra. I must add
> that supertypes are appropriate for a super language.

--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at:  http://www.mcondic.com/

    "I'd trade it all for just a little more"
        --  Charles Montgomery Burns, [4F10]
======================================================================





^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Supertypes RE: Extensible Enumerated types
@ 2001-02-01  1:20 Beard, Frank
  2001-02-01  3:29 ` Jeffrey Carter
  0 siblings, 1 reply; 5+ messages in thread
From: Beard, Frank @ 2001-02-01  1:20 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

Bob,

I like Jeff Creem's idea of:

type Fruit_Type is (Apple, Orange);
type New_Fruit_Type is new Fruit_Type with (Pear, Kiwi);

So your example would be:

-- from Package Prefix_Recs
type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev,
    Other);

--From Package Prefix_Recs.Army
type Army_Prefix_Type is new Prefix_Type with (Private, Corporal, Sergeant,
Lieutenant, Captain, Major, Colonel, General);

Wouldn't this serve your purposes without the need of adding a new
reserved word?

Frank


-----Original Message-----
From: Robert C. Leif, Ph.D. [mailto:rleif@rleif.com]
Sent: Wednesday, January 31, 2001 3:05 AM
To: comp.lang.ada@ada.eu.org
Subject: Supertypes RE: Extensible Enumerated types 

> This is suggestion includes the addition of a new keyword to Ada. I
realize
> that some would consider this rank heresy.
>
> Since Ada has Subtypes to specify a subset of a type, it would be
reasonable
> to create a symmetrical operation to create a superset of a type.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Supertypes RE: Extensible Enumerated types
  2001-02-01  1:20 Supertypes RE: Extensible Enumerated types Beard, Frank
@ 2001-02-01  3:29 ` Jeffrey Carter
  2001-02-01 23:56   ` Nick Roberts
  0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey Carter @ 2001-02-01  3:29 UTC (permalink / raw)


"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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Supertypes RE: Extensible Enumerated types
  2001-02-01  3:29 ` Jeffrey Carter
@ 2001-02-01 23:56   ` Nick Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Roberts @ 2001-02-01 23:56 UTC (permalink / raw)


I've posted to this newsgroup elsewhere pretty much using Jeff Creem's
suggested syntax, also detailing the conversions and other issues.

--
Nick Roberts
http://www.AdaOS.org






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-02-01 23:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-01  1:20 Supertypes RE: Extensible Enumerated types Beard, Frank
2001-02-01  3:29 ` Jeffrey Carter
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

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