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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec1a210f9e3b089e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-08 00:42:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!dialin-145-254-039-217.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ranges and discriminant constraints Date: Sun, 08 Jun 2003 09:45:24 +0200 Organization: At home Message-ID: References: <665e587a.0306071258.1a8711cc@posting.google.com> <665e587a.0306072200.3d476477@posting.google.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-039-217.arcor-ip.net (145.254.39.217) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1055058165 13483402 145.254.39.217 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:38826 Date: 2003-06-08T09:45:24+02:00 List-Id: Vadim Godunko wrote: > "AG" wrote in message > news:... >> "Vadim Godunko" wrote in message >> news:665e587a.0306071258.1a8711cc@posting.google.com... >> >> > Does anybody explain me why language allow constraint discriminant of >> > discrete type to some value, but not allow constraint to range? >> >> If I understood you correctly you mean something like this: [?] >> >> type abc is (a, b, c); >> type test(y: abc) is record >> ... >> z: test(a); -- Which compiles >> vs >> z: test(a..c); -- Which doesn't >> > Not exactly. I mean: > > type abc is (a, b, c); > type r (k : abc) is record ... > > subtype rab is r (a .. b); > > procedure p (v : rab); Maybe because the next requirement could be: subtype rac is r (a | c); However, if some time pre-/post-conditions would appear in Ada, one could have same effect with: procedure p (v : r) when r.k = a or r.k = c; -- (ad-hoc subtype) -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de