comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM>
Subject: "constant X renames" (language-lawyers)
Date: 1996/12/11
Date: 1996-12-11T00:00:00+00:00	[thread overview]
Message-ID: <9612111834.AA12317@most> (raw)


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
-----------------------------------------------------------------------------




             reply	other threads:[~1996-12-11  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-11  0:00 W. Wesley Groleau (Wes) [this message]
1996-12-13  0:00 ` "constant X renames" (language-lawyers) Vincent Marciante
1996-12-13  0:00 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox