comp.lang.ada
 help / color / mirror / Atom feed
From: Kilgallen@SpamCop.net (Larry Kilgallen)
Subject: Re: subtype of enumeration type
Date: 20 Mar 2006 08:26:44 -0600
Date: 2006-03-20T08:26:44-06:00	[thread overview]
Message-ID: <gmiRaAP4tbKY@eisner.encompasserve.org> (raw)
In-Reply-To: dvmas1$kj8$1@sunnews.cern.ch

In article <dvmas1$kj8$1@sunnews.cern.ch>, Maciej Sobczak <no.spam@no.spam.com> writes:
> Consider this:
> 
>     type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
> 
> and the following standard example:
> 
>     subtype Weekday is Day range Mon .. Fri;
> 
> Now imagine that in some country children don't have to go to school on 
> Wednesdays, they go there only Monday, Tuesday, Thursday and Friday.
> 
> I want to say it in Ada.
> 
>     subtype Schoolday is Day <what goes here?>;

     type Day is (Mon, Tue, Thu, Fri, Wed, Sat, Sun);
     subtype Weekday is Day range Mon .. Wed;
     subtype Schoolday is Day range Mon .. Fri;

Some additional logic may also be in order if you print some
some human-readable output based on an iteration over the range
of Day or Weekday, such as by creating an index array Days_in_Order.



  reply	other threads:[~2006-03-20 14:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-20 13:31 subtype of enumeration type Maciej Sobczak
2006-03-20 14:26 ` Larry Kilgallen [this message]
2006-03-20 15:18   ` Maciej Sobczak
2006-03-20 15:37 ` Robert A Duff
2006-03-20 20:29 ` Björn Persson
2006-03-20 21:41 ` Jeffrey R. Carter
2006-03-21  8:37   ` subtypes and preconditions (was: subtype of enumeration type) Peter Amey
2006-03-21 17:42     ` subtypes and preconditions Jeffrey R. Carter
2006-03-21 19:00       ` Georg Bauhaus
2006-03-22  1:54         ` Jeffrey R. Carter
replies disabled

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