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-Language: ENGLISH,ASCII X-Google-Thread: 103376,5f3fcf3eb242e4c1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-18 02:38:41 PST Message-ID: <3B5558A5.716BF610@amsjv.com> Date: Wed, 18 Jul 2001 10:36:37 +0100 From: Philip Anderson Organization: Alenia Marconi Systems ISD X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: casecrash: language lawyers: C'mon! References: <9j1cpn$bis$1@infosun2.rus.uni-stuttgart.de> <3b553588$1@pull.gecm.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: cwmwkn0612.cwmbran.gecm.com X-Trace: 18 Jul 2001 10:27:18 GMT, cwmwkn0612.cwmbran.gecm.com Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!195.86.7.162!newsfeed.wirehub.nl!shale.ftech.net!news.ftech.net!dispose.news.demon.net!demon!btnet-peer0!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!cwmwkn0612.cwmbran.gecm.com Xref: archiver1.google.com comp.lang.ada:10136 Date: 2001-07-18T10:36:37+01:00 List-Id: Martin Dowie wrote: > > I think what the original poster is getting at is that it > would seem perfectly obvious that the case statement is > referring to the data object called 'H' rather than the > enumerate 'H', so why can't the language be defined to > spot this case? That I think was his question. But it's not actually the problem the compiler found, which was the illegal declaration of the object H (because it is a homograph of the enumeration H). And that rule is IMHO well-founded, since there are contexts when writing H would be ambiguous. Nearer to the original question would be the following: with Ada.Text_Io; use Ada.Text_Io; procedure Casecrash is package Local is type Record_Type is (A, B, C, D, E, F, G, H, I, J, K, L, Unknown); end Local; use Local; type Header is record Id_Letter : Record_Type := Unknown; end record; H : Header; begin case H.Id_Letter is when A => Put ("a"); when H => --H is not static [RM_95 3.8.1(8); 5.4(5)] --H is not a value of Record_Type Put ("h"); -- H conflict, name clash? -- no context resolution? when others => Put ("*"); end case; end Casecrash; since H the enumeration literal has been overriden by the H the object, although the (Rational Apex) compiler is happy with A in this context. RM 8.4(10) seems to apply here. -- hwyl/cheers, Philip Anderson Alenia Marconi Systems Cwmbr�n, Cymru/Wales