* opaque types/information hiding
@ 1988-11-28 22:00 Scott Moody
0 siblings, 0 replies; only message in thread
From: Scott Moody @ 1988-11-28 22:00 UTC (permalink / 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 ...
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1988-11-28 22:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-11-28 22:00 opaque types/information hiding Scott Moody
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox