comp.lang.ada
 help / color / mirror / Atom feed
From: marciant@newshost.li.net (Vincent Marciante)
Subject: Re: "constant X renames" (language-lawyers)
Date: 1996/12/13
Date: 1996-12-13T00:00:00+00:00	[thread overview]
Message-ID: <58ql5k$h9u@linet06.li.net> (raw)
In-Reply-To: 9612111834.AA12317@most


Just leave out "constant" the renaming will work.

I sometimes rename subprogram parameters in the body by design; It is a
way to choose a parameter name that makes a call of the subprogram
readable yet also use a name in the body that makes the implementation
more readable.  That way the name that is the best from the particular 
point view can be used!


procedure Get (The_Value                 : out Value;
               After_Checking_The_Source : in  Source) is

  The_Source : Source renames After_Checking_The_Source; 

begin
  if The_Source = ...
     The_Value := ...   
  else
     ...
  end if; 
end Copy;

 W. Wesley Groleau (Wes) (wwgrol@PSESERV3.FW.HAC.COM) wrote:
: 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.)





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

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

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