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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d0452dbe16ac0df4 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: ObjectAda vs Gnat -- bugs Date: 1997/05/16 Message-ID: #1/1 X-Deja-AN: 241809587 References: <5lf6ka$nbg@service.polymtl.ca> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-05-16T00:00:00+00:00 List-Id: In article <5lf6ka$nbg@service.polymtl.ca>, granger wrote: >Here is a shortened version of a package that I wrote. Is this supposed to be the obfuscated Ada contest? I mean, grey vs. bray makes my brain hurt. ^^^^ Of course, I meant to type "gray", but I like the typo, so I'll leave it in. ;-) >It compiles without any error with ObjectAda. >With gnat3.09, I have the following errors: > >rgbcolor.ads:18:41: expect object name in renaming >rgbcolor.ads:19:49: expect object name in renaming > >Which of the compilers is correct ? > >If gnat is correct ( probably gnat!!!), Why do you say "probably gnat"? >... the internal package RGB_Value does > not have any influence, how can I have the enumeration values Gray* and > Grey* of the same type or subtype with the same internal value ? > >Thank in advance for any suggestion. > >package rgbcolor is > package RGB_Value is > type Color3 is > record > red, green, blue : Float; > end record; > Gray0 : constant Color3 := ( 0.000, 0.000, 0.000 ); > Grey0 : Color3 renames Gray0; > Gray1 : constant Color3 := ( 0.012, 0.012, 0.012 ); > Grey1 : Color3 renames Gray1; > end RGB_Value; > > type Color_Type is ( Gray0, Gray1 ); > > subtype Grey_Color_Type is Color_Type range Gray0 .. Gray1; > > Grey0 : Color_Type renames Gray0; -- line in error--------------- > Grey1 : Color_Type renames Gray1; -- line in error--------------- This looks legal, to me. You're renaming calls to the enum lits (which are like functions, in Ada). Perhaps you meant to say: function Grey0 return Color_Type renames Gray0; ... and similarly for gr[ea]y1. ;-) But either way, it should be legal. Package RGB_Value has nothing to do with this, as far as I can tell. - Bob