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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,75ffc1f081ec10e3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!newshub.sdsu.edu!newsfeed.news2me.com!sn-xt-sjc-15!sn-xt-sjc-07!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail From: "ME" Newsgroups: comp.lang.ada Subject: Re: Constant record components Date: Fri, 14 Jul 2006 20:45:13 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <12bgp70gme60s9e@corp.supernews.com> References: <12afs64kh432q0e@corp.supernews.com> <12aihj2lrjqpc3a@corp.supernews.com> <7bednaJHX_FTMDTZnZ2dnUVZ_uudnZ2d@megapath.net> <12ak5urrrj6d756@corp.supernews.com> <12arsrtbe8flpf8@corp.supernews.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Complaints-To: abuse@supernews.com Xref: g2news2.google.com comp.lang.ada:5705 Date: 2006-07-14T20:45:13-07:00 List-Id: "Craig Carey" wrote in message news:i04fb2t4vicb69kl55gsk1surko57g16vc@4ax.com... > > Fixing renames. > > On Fri, 14 Jul 2006 20:15:53 +1200, Craig Carey wrote: >>On Fri, 7 Jul 2006 16:04:13 -0500, "Randy Brukardt" wrote: > ... >>>with them (only directly when the object is created), or you have to have >>>some rule like "they're read-write in the body", which is what is >>>disgusting. And remember that Initialize isn't the only routine of this > ... > > A mispelling got partly towards converting jersey into jess, a leather > strap sometimes attached to the leg of a hawk or falcon. > > At last check, Ada was not really making any progress at interfacing > with C++, eg. in the following R.R would be written. > > generic > Debug : Integer; > package R is > type R'Pkg_Type; -- Prevent an extra pass or "class package" etc. > -- R could be a subtype if tagged for interfacing with C++. > > type R'Pkg_Type (D : DT) is > record > A1 : Integer; > A2 : in Integer; > end record; > > -- "in" means that in the view of exterior code the value > -- can't be written to I like it! > > procedure Get_Val (X : out R, Fname : Str); > end package R > > X : R (Dbg => 0) (D => D1); > > procedure Main is > begin > Get_Val (\ X, Fname => "abc.txt"); > X.A2 := 9; -- Syntax error. > > The Ada Reference Manual does not use enough words to say what > "renames" should do. GNAT tries to know the memory addresses > finalized inside of the declaration block. > > When often encountering the mistake, it seems that a > > K : Integer := 1; > while K < 10 loop > declare > A : Integer; > K : constant; -- Lock K down as a constant > E : Element renames A (K); > -- Now it is clear E's address is now known > begin -- K is constant > -- Actually making K constant after the begin would be safer > > > > > Craig Carey