TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional 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
Subject:
From:
AdaWorks <[log in to unmask]>
Reply To:
Date:
Thu, 4 Feb 1999 11:14:24 -0800
Content-Type:
TEXT/PLAIN
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
      private
          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]
http://www.adaworks.com

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

ATOM RSS1 RSS2