From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e58bb9b46b60f0fb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: subtype of enumeration type Date: Mon, 20 Mar 2006 16:18:34 +0100 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1142867913 4071 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060203 Red Hat/1.7.12-1.1.3.4 X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:3495 Date: 2006-03-20T16:18:34+01:00 List-Id: 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 ; > 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/