From: "ME" <abcdefg@nonodock.net>
Subject: Re: Constant record components
Date: Fri, 14 Jul 2006 20:45:13 -0700
Date: 2006-07-14T20:45:13-07:00 [thread overview]
Message-ID: <12bgp70gme60s9e@corp.supernews.com> (raw)
In-Reply-To: i04fb2t4vicb69kl55gsk1surko57g16vc@4ax.com
"Craig Carey" <research@ijs.co.nz> 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
next prev parent reply other threads:[~2006-07-15 3:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <12ad8guf3sg1o0d@corp.supernews.com>
2006-07-01 17:06 ` Constant record components Dmitry A. Kazakov
2006-07-01 17:37 ` ME
2006-07-01 18:33 ` Georg Bauhaus
2006-07-01 21:44 ` Jeffrey R. Carter
2006-07-02 9:18 ` Georg Bauhaus
2006-07-02 16:13 ` ME
2006-07-03 7:50 ` Dmitry A. Kazakov
2006-07-03 11:46 ` Craig Carey
2006-07-04 0:06 ` M E Leypold
2006-07-03 16:31 ` ME
2006-07-03 23:53 ` Randy Brukardt
2006-07-04 1:59 ` Craig Carey
2006-07-04 7:25 ` ME
2006-07-05 21:55 ` Randy Brukardt
2006-07-06 0:59 ` tmoran
2006-07-06 7:47 ` Jean-Pierre Rosen
2006-07-06 22:29 ` Randy Brukardt
2006-07-07 4:34 ` Jeffrey R. Carter
2006-07-07 5:39 ` ME
2006-07-07 9:15 ` Georg Bauhaus
2006-07-08 16:13 ` ME
2006-07-08 17:14 ` Georg Bauhaus
2006-07-13 6:58 ` ME
2006-07-13 8:39 ` Georg Bauhaus
2006-07-07 21:04 ` Randy Brukardt
2006-07-14 8:15 ` Craig Carey
2006-07-14 12:51 ` Craig Carey
2006-07-15 3:45 ` ME [this message]
2006-07-04 0:08 ` M E Leypold
2006-07-02 5:52 ` Craig Carey
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox