From: Samuel Tardieu <sam@inf.enst.fr>
Subject: Re: Generic Packages
Date: 1996/03/22
Date: 1996-03-22T00:00:00+00:00 [thread overview]
Message-ID: <qw6vijx59w0.fsf@gargantua.enst.fr> (raw)
In-Reply-To: 4iugrr$r4h@newsbf02.news.aol.com
>>>>> "John" == John Herro <johnherro@aol.com> writes:
John> generic formal parameter is treated as a constant in any
John> case. For this reason you can't declare
John> generic
John> Number : constant Integer;
John> package P is ...
Mmm... I think you are wrong. The reason which prevents you from
modifying Number in your first example is that the "in" keyword is
ommitted. A generic formal may be either "in" or "in out" (of course,
not "out" only).
So you may do:
generic
Number : in out Integer;
package G is
procedure Increment;
end G;
package body G is
procedure Increment is
begin
Number := Number + 1;
end Increment;
end G;
with G;
with Text_IO; use Text_IO;
procedure T is
I : Integer := 5;
package P is new G (I);
begin
Put_Line (Integer'Image(I));
P.Increment;
Put_Line (Integer'Image(I));
end T;
and it will print:
5
6
Sam
--
"La cervelle des petits enfants, ca doit avoir comme un petit gout de noisette"
Charles Baudelaire
next prev parent reply other threads:[~1996-03-22 0:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4inq3c$lr9@NNTP.MsState.Edu>
1996-03-22 0:00 ` Generic Packages John Herro
1996-03-22 0:00 ` Samuel Tardieu [this message]
[not found] <5e03nm$esq@netty.york.ac.uk>
1997-02-15 0:00 ` Jon S Anthony
1997-02-20 0:00 ` phtruong
1997-02-21 0:00 ` Robert Dewar
1997-02-25 0:00 ` Quorlia
1997-02-27 0:00 ` Robert Dewar
1998-08-10 0:00 Tory Patnoe
1998-08-11 0:00 ` Robert I. Eachus
1998-08-11 0:00 ` Tucker Taft
1998-08-12 0:00 ` Dale Stanbrough
1998-08-17 0:00 ` Dr. Hubert B. Keller
1998-08-27 0:00 ` Simon Wright
-- strict thread matches above, loose matches on Subject: below --
2000-02-16 0:00 Generic packages David Olsson
2000-02-16 0:00 ` R. Tim Coslet
2001-04-19 21:27 Generic Packages Eyal Ben-gal
2001-04-19 20:26 ` Ehud Lamm
2001-04-19 22:09 ` Robert A Duff
2001-04-20 6:50 ` Ehud Lamm
2002-07-09 13:03 generic packages Sami Evangelista
2002-07-09 13:28 ` Fabien Garcia
2002-07-09 13:41 ` Sami Evangelista
2002-07-10 2:00 ` SteveD
2002-07-11 13:41 ` Sami Evangelista
2002-07-11 20:56 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox