comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: subtype of enumeration type
Date: Mon, 20 Mar 2006 16:18:34 +0100
Date: 2006-03-20T16:18:34+01:00	[thread overview]
Message-ID: <dvmh49$3v7$1@sunnews.cern.ch> (raw)
In-Reply-To: <gmiRaAP4tbKY@eisner.encompasserve.org>

Larry Kilgallen wrote:

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

First of all, I might need to define the subtypes *after* Day is defined 
and I might not have write access to the module where Day is defined.

Second, let's say that in addition I get the piano lessons all Tuesdays, 
Wednesdays and Thursdays:

    subtype Pianoday is Day <what goes here?>;


> Some additional logic may also be in order if you print some
> some human-readable output based on an iteration

This additional logic would be needed only because you have changed the 
order of elements in the primary type for the purpose of defining the 
subtype, thus introducing the *reverse* source code dependency between 
these types.
In other words, the need for this "additional logic" is exactly the 
indication that this solution is not acceptable.

So - is it at all possible? If yes, how? If not, what is the sense of 
providing these kind of examples even in RM, if the concept simply does 
not work?


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



  reply	other threads:[~2006-03-20 15:18 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
2006-03-20 15:18   ` Maciej Sobczak [this message]
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