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,206123971e05e480,start X-Google-Attributes: gid103376,public From: "W. Wesley Groleau (Wes)" Subject: "constant X renames" (language-lawyers) Date: 1996/12/11 Message-ID: <9612111834.AA12317@most>#1/1 X-Deja-AN: 203593755 sender: Ada programming language comments: Gated by NETNEWS@AUVM.AMERICAN.EDU mailer: Elm [revision: 70.85] newsgroups: comp.lang.ada Date: 1996-12-11T00:00:00+00:00 List-Id: procedure Proc ( Stupid_Name : in Param_Type ) is Sensible_Name : constant Param_Type renames Stupid_Name; -------------------- This is illegal by LRM 83 8.5 (2) and LRM 95 8.5.1 (2) because "constant" is not part of a (sub)type mark. The restriction makes sense in a way, since the item is already a constant and if it weren't we still can't change its properties by renaming. Still, it surprised me after nearly ten years of Ada programming. (I wouldn't have even tried it if my predecessor had used a better name.) Was this "feature" planned, or just an accident/side-effect? There is no specific language about it to indicate it was thought of. In fact, the BNF for "(sub)type_mark in section three is the only thing I can find that makes it illegal--section eight says renaming will not change whether it is or isn't constant, but doesn't come right out and prohibit calling it constant. "constant" has documentation value in this case. One might also imagine a case where for documentation purposes one wants the new view to never have assignments even though the old is assignable. On the other hand, allowing "constant" might make a programmer think that a renames without the keyword is assignable--which may not true. ----------------------------------------------------------------------------- W. Wesley Groleau (Wes) wwgrol x4923 MS 10-40 10C2C6 AFATDS IG -----------------------------------------------------------------------------