comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Visible or hidden derivation for controlled types ?
Date: 1997/03/14
Date: 1997-03-14T00:00:00+00:00	[thread overview]
Message-ID: <3329621A.3E9D@elca-matrix.ch> (raw)


There was a discussion some time ago in comp.lang.ada on whether Adjust,
Finalize and Initialize for Controlled types was better done in the
visible or private part of the package. In both cases, the type was
visibly derived from Ada.Finalization.Controlled.

I'd like to know if it is better to make types visibly derived from
Ada.Finalization.Controlled, or do that derivation in the private part:

Visible:

   generic
      type Element_Type is private;
      with function "=" (Left, Right : Element_Type) return Boolean;
      with function "<" (Left, Right : Element_Type) return Boolean;
   package Binary_Trees is

      type Binary_Tree is new Ada.Finalization.Controlled with private;

      procedure Adjust, ...

      ...

   private

      type Binary_Tree is new Ada.Finalization.Controlled with
         record
            ...
         end record;

   end;

or invisible:

   generic
      type Element_Type is private;
      with function "=" (Left, Right : Element_Type) return Boolean;
      with function "<" (Left, Right : Element_Type) return Boolean;
   package Binary_Trees is

      type Binary_Tree is private;

      ...

   private

      type Binary_Tree is new Ada.Finalization.Controlled with
         record
            ...
         end record;

      procedure Adjust, ...

   end;

Any ideas on which approach is best ?




             reply	other threads:[~1997-03-14  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-14  0:00 Mats Weber [this message]
1997-03-15  0:00 ` Visible or hidden derivation for controlled types ? Tom Moran
1997-03-17  0:00   ` Jon S Anthony
1997-03-16  0:00 ` Matthew Heaney
1997-03-16  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox