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,f6c4733a3385e3f8 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: I just found that funny... Date: 1996/04/06 Message-ID: #1/1 X-Deja-AN: 146087686 references: <199604051600.SAA07609@email.enst.fr> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-04-06T00:00:00+00:00 List-Id: Jean-Pierre complained: \ "function Last_Day (Of : Months) return Date; \ \ GNAT appropriately complained that "Of is a reserved word that cannot be used \ as an identifier". So the next thing that sprung to my mind was: \ \ function Last_Day (In : Months) return Date; \ \ Nooooooo ! Think of something else... \ \ function Last_Day (For : Months) return Date; \ \ Arghhhhhhh.... I ended up with: \ \ function Last_Day (Of_Month : Months) return Date;" Now I would have liked to fix that by doing: function Last_Day (Of_ : Months) return Date; but lots of people turned out to be allergic to trailing underscores. We got it in for a while, but then the French delegation in particular absolutely insisted on its removal :-) Incidentally, this is a nice example on which to demontstrate an interesting little bit of error handling stuff in GNAT: 2. function Last_Day (Of : Months) return Date; | >>> reserved word "of" cannot be used as identifier 2. function Last_Day (of : Months) return Date; | >>> identifier expected Note that GNAT guesses by your casing whether you intended to write an identifier or keyword. Of course it only pays attention to case *if* Just in case you are Mike Feldman (:-) or someone else who likes to use some different casing convention: 2. FUNCTION Last_Day (Of : Months) RETURN Date; | >>> reserved word "OF" cannot be used as identifier 2. FUNCTION Last_Day (OF : Months) RETURN Date; | >>> identifier expected As you see, GNAT learns the style you are using (and also uses this same style in error messages). If you are used to programming in a certain one letter language and think that using different cases for keywords and identifiers is silly :-), then 2. function last_day (of : months) return date; | >>> reserved word "of" cannot be used as identifier GNAT guessed right in this case, but cannot always do such a good job if it does not have the extra clue. Generally you get better error messages out of GNAT if you indent and layout your code consistently, and if you use a consistent scheme for differentiating the casing of keywords and identifiers.