TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

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

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

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

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.

ATOM RSS1 RSS2