[comp.lang.ada] Deferring the definition of a private type to the body

sommar@enea.se (Erland Sommarskog) (11/27/88)

Richard Pattis (pattis@june.cs.washington.edu) writes:
>  Finally, if I recall my Ada correctly, one can use access types in Ada to
>implement private types that are equivalent to Modula-2's opaque types, at
>least with regard to portability problems residing in package bodies.  I
>believe Cohen's book had a discussion of this use of access types in the
>private parts of packages.

Not that I have read the book, but it's that hard to find it out 
yourself. If you want to defer the implementation of your private 
type to the package body try the following:

PACKAGE Nisse IS
   TYPE My_own IS PRIVATE;   -- or LIMITED of you prefer.
   ...
PRIVATE
   TYPE My_own_machine_dependent_implemtation;
   TYPE My_own IS ACCESS My_own_machine_dependent_implemtation;
END Nisse;

PACKAGE BODY Nisse IS
   TYPE My_own_machine_dependent_implemtation IS
      -- whatever you feel like.
   ....
END Nisse;

So those wanted this into the language are you satisfied? And can we
who want the implementation being in the specification continue to
do? Having a pointer for every small little integer or enumerate doesn't
like a bright idea to me.
-- 
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.se
"Frequently, unexpected errors are entirely unpredictable" - Digital Equipment

ugcaico@cs.Buffalo.EDU (Frank Caico) (12/03/88)

Im using Ada on an Encore Mulitmatic and am having problems with puts.

(should be a standard ada syntax question)
why is it when i want to print out a string value sometimes i have to 
include a .s or the compiler gives me an incorrect type error?

ex;       put (argv(x).s);

im using Ada on an Encore Multimatic with their compiler.
.