From: steve.folly@rdel.co.uk (Steve Folly)
Subject: generic formal object parameters of mode 'in out'
Date: 2000/11/06
Date: 2000-11-06T16:42:33+00:00 [thread overview]
Message-ID: <3a06dc1c.259466533@news.rrds.co.uk> (raw)
Hi,
While reading the ARM today I noticed it's possible to specify generic
formal objects of mode 'in out'.
I was just wondering what use this could have?
Para 12.4 [1b] does state that it's like a renaming declaration of the
explicit actual parameter.
In my program I have the following generic package...
subtype Template_String is string(1..4);
generic
type T is private;
Default : T;
Template : Template_String;
package P
The_Template : constant String := Template;
.
.
end P;
We have had to declare The_Template because we've found that the
parameters are not visible from an instantiation, ie.
declare
package X is new P ( T => Integer, Default => 0, Template => "NNNN"
);
begin
Ada.Text_Io.Put_Line("The template is " & X.Template ); -- uh oh!
Ada.Text_Io.Put_Line("The template is " & X.The_Template ); -- OK
end;
Am I right in thinking that by making Template an 'in out', I don't
need The_Template.
And, if it is now an 'in out', can I change Template at any time
outside of the instantiation (or inside it) ?
Just my disjointed ramblings at the end of long day...
Cheers,
Steve Folly.
next reply other threads:[~2000-11-06 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-06 0:00 Steve Folly [this message]
2000-11-06 0:00 ` generic formal object parameters of mode 'in out' mark_lundquist
2000-11-06 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