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,ce896fd16cf323ae X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Wojtek Narczynski Newsgroups: comp.lang.ada Subject: Re: Enumeration representation enhancement proposal Date: Wed, 20 Oct 2004 10:41:46 +0200 Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <2t7sd8F1rsqh9U1@uni-berlin.de> NNTP-Posting-Host: avl124.neoplus.adsl.tpnet.pl Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: nemesis.news.tpi.pl 1098261920 7229 83.27.45.124 (20 Oct 2004 08:45:20 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Wed, 20 Oct 2004 08:45:20 +0000 (UTC) User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Xref: g2news1.google.com comp.lang.ada:5501 Date: 2004-10-20T10:41:46+02:00 List-Id: Hello, >> I don't follow, could you provide a sample Ada code which would be >> problematic? > > for Colours use (Red => 1, Green => 2, Blue => 4, Muddy => others); > > if Muddy < Blue then > -- Do we ever get here? Both 3 and 5 represents Muddy. The one > -- is smaller than 4 (which represents Blue), the other one > -- isn't. end if; > end if; (I may be repeating myself, my previous reply somehow didn't make it to the server...) Clearly, representation has no impact on comparison. So we do not get there, granted that such is the order of declaration in Ada. The above code is not harder to compile than: for Colours use (Red => 1, Green => 3, Blue => 2, Muddy => 4); A, B : Colors; if A < B then null; end if; Here the result is also rather unrelated to the underlying rep values order. Also, a simple "cannonicalization" {take the least possible 'others' value to the register (not memory)} makes the case with 'others' identical to current situation. Regards, Wojtek