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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: subtype of enumeration type Date: 20 Mar 2006 10:37:26 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1142869047 11909 192.74.137.71 (20 Mar 2006 15:37:27 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 20 Mar 2006 15:37:27 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:3494 Date: 2006-03-20T10:37:26-05:00 List-Id: Maciej Sobczak 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 ; You can't do that. You could put "pragma Assert(Some_Day /= Wednesday)" all over the place, but that's not quite the same thing. Eiffel allows arbitrary conditions as invariants, but Ada has a fairly restricted set of constraints (ranges for discrete types, a single value for discriminant constraints, etc). - Bob