comp.lang.ada
 help / color / mirror / Atom feed
From: scott@shuksan.UUCP (Scott Moody)
Subject: opaque types/information hiding
Date: 28 Nov 88 22:00:17 GMT	[thread overview]
Message-ID: <992@shuksan.UUCP> (raw)

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 ...

                 reply	other threads:[~1988-11-28 22:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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