comp.lang.ada
 help / color / mirror / Atom feed
* Deferring the definition of a private type to the body
@ 1988-11-26 22:35 Erland Sommarskog
  1988-12-02 16:49 ` Frank Caico
  0 siblings, 1 reply; 2+ messages in thread
From: Erland Sommarskog @ 1988-11-26 22:35 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Deferring the definition of a private type to the body
  1988-11-26 22:35 Deferring the definition of a private type to the body Erland Sommarskog
@ 1988-12-02 16:49 ` Frank Caico
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Caico @ 1988-12-02 16:49 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1988-12-02 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-11-26 22:35 Deferring the definition of a private type to the body Erland Sommarskog
1988-12-02 16:49 ` Frank Caico

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