[comp.lang.ada] opaque types/information hiding

scott@shuksan.UUCP (Scott Moody) (11/29/88)

About a year ago I found out a neat feature of package specs and
private types that I didn't know before, and only found out
by reading the fine print.

If a private type is a pointer to something, then the declaration
of that something doesn't have to be included in the spec,  but 
can be differed to the body. The compiler knowns from the spec
that a pointer is used so it knows how big y will be. This way 
real information hiding is achieved (versus showing what it is but
not letting them touch it).

(Unfortunately Verdix (year ago) had a bug with 
the implementation but that is another story ...)

*****
e.g. 

   package  X is
      type y is limited private;

      procedure something(arg:y);
   
   private
      type y_rec;

      type y is access y_real;
   end X;
   -------------------------------
   package body X is

      type y_rec is record ... end;

      ...

   end X;

*****

Just thought someone might like it ...