TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text 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]>
X-To: Samuel Mize <[log in to unmask]>
Date: Thu, 4 Feb 1999 11:14:24 -0800
Reply-To: AdaWorks <[log in to unmask]>
From: AdaWorks <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Content-Type: TEXT/PLAIN; charset=US-ASCII
MIME-Version: 1.0
Parts/Attachments: 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