TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Coniam, Todd (MSgt)" <[log in to unmask]>
Fri, 4 Dec 1998 11:08:33 -0600
text/plain (29 lines)
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.


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;
      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.