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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,115cdbb394b3e615,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail From: brett_gengler@yahoo.com Newsgroups: comp.lang.ada Subject: Why can't you create a out of order subtype? Date: 1 Feb 2005 15:51:54 -0800 Organization: http://groups.google.com Message-ID: <1107301914.648240.237290@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: 12.31.157.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1107301919 23622 127.0.0.1 (1 Feb 2005 23:51:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 1 Feb 2005 23:51:59 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=12.31.157.162; posting-account=Y2i2nRIAAAC8vqYhz-n9FN2iANGBgZ5xyKHGNUA9-xAUdy3s_QltMA Xref: g2news1.google.com comp.lang.ada:8123 Date: 2005-02-01T15:51:54-08:00 List-Id: I created a type whose order can not be rearranged and I want to create a subtype of that type. So, type msg is ( msg_a, msg_b, msg_c, msg_d, msg_e); subtype vowel_msg is msg (msg_a, msg_e); --wrong, but why? Is it true that I can't define a a subtype that's not a ordered subrange of a type? My issue is that I want to enforce the subtype at compile time instead of creating an array of booleans and doing a run time check. (This is for an interface and I don't trust people to send me the right types). vowel_filter is array(msg) of Boolean := (msg_a => True, msg_e => True, others => False); --yuck. Another option that I think is much, much worse then the boolean array would be create an overloaded type... type msg is ( msg_a, msg_b, msg_c, msg_d, msg_e); type vowelmsg ( msg_a, msg_e); But as you know, msg.msg_e = 4 and vowelmsg.msg_e = 1 so an unchecked conversion is wrong on so many levels. Am I screwed? Should I just implement a boolean array and shut up about it?