comp.lang.ada
 help / color / mirror / Atom feed
* "constant X renames" (language-lawyers)
@ 1996-12-11  0:00 W. Wesley Groleau (Wes)
  1996-12-13  0:00 ` Vincent Marciante
  1996-12-13  0:00 ` Robert A Duff
  0 siblings, 2 replies; 3+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-12-11  0:00 UTC (permalink / 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
-----------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-12-13  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-11  0:00 "constant X renames" (language-lawyers) W. Wesley Groleau (Wes)
1996-12-13  0:00 ` Vincent Marciante
1996-12-13  0:00 ` Robert A Duff

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