> -----Message d'origine-----
> De:   Coniam, Todd (MSgt) [SMTP:[log in to unmask]]
> Date: vendredi 4 decembre 1998 18:09
> A:    [log in to unmask]
> Objet:        Re: Static variables in Ada
>
> I would say make an inner package, called STATIC, that
> holds all static variables.  Then use a renames clause
> in each subprogram of the outer package to get a direct
> simple name visibility.
>
> Example:
>
> Package body Bar is
>
>    Package Static is
>       Foo_V : integer;  -- that way we can have other V's
>       ...
>    End Static;
>    ...
>    Function Foo return Integer is
>       V : Integer renames Static.Foo_V;
>    Begin
>       V := Init_Static;
>       ...
>    End Foo;
>
> End Bar;
>
> The only disadvantage I see is that you have to
> change the type name in two places (Static, Foo)
> if it ever needs to change.

I really don't like this solution because Foo_V is usable by others procedures
or functions
in Bar package. And this is another disadvantage !

The best solution seem to be the package Outer/Inner provided by Mark
Lundquist. In this
example only one function (or a set of function declared in Inner) could access
the "static"
variable.

Pascal.

--|------------------------------------------------------------
--| Pascal Obry                               Team-Ada Member |
--|                                                           |
--| EDF-DER-IPN-SID- T T I                                    |
--|                       Intranet: http://cln46gb            |
--| Bureau N-023            e-mail: [log in to unmask]     |
--| 1 Av General de Gaulle  voice : +33-1-47.65.50.91         |
--| 92141 Clamart CEDEX     fax   : +33-1-47.65.50.07         |
--| FRANCE                                                    |
--|------------------------------------------------------------
--|
--|   http://ourworld.compuserve.com/homepages/pascal_obry
--|
--|   "The best way to travel is by means of imagination"