TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: "Coniam, Todd (MSgt)" <[log in to unmask]>
Date: Fri, 4 Dec 1998 11:08:33 -0600
Reply-To: "Coniam, Todd (MSgt)" <[log in to unmask]>
Parts/Attachments: 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.