TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

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

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

Print Reply
AdaWorks <[log in to unmask]>
Reply To:
Thu, 4 Feb 1999 11:14:24 -0800
TEXT/PLAIN (38 lines)
As I understand the question, it has to do with deferred constants.
David Hoos' reply was good for the syntactic solution.  However, good
object-oriented programming style would suggest that we abandon the
use of deferred constants in our package designs.  The usual form is
something such as,

      package P is
          type T is private;
          Empty_T : constant T;
          -- more public stuff
          full definitions of private stuff
      end P;

The more object-oriented way to approach this is to export a function
for Empty_T in place of the deferred constant.

             function Empty_T return T;

This allows a variety of implementations on Empty_T, eliminates problems
of dependecies when we change the values of the constants later, and
improves maintainability.  It also eliminates the need for the designer
to fool around with syntax better left to the package implementor.

Richard Riehle
[log in to unmask]

Richard Riehle
[log in to unmask]
AdaWorks Software Engineering
Suite 30
2555 Park Boulevard
Palo Alto, CA 94306
(650) 328-1815
FAX  328-1112