comp.lang.ada
 help / color / mirror / Atom feed
From: sommar@enea.se (Erland Sommarskog)
Subject: Re: limited private types
Date: 3 Dec 88 23:10:54 GMT	[thread overview]
Message-ID: <4126@enea.se> (raw)

Ron Guilmette (rfg@nsc.nsc.com.UUCP) wants to be able to defer the 
implementation of a (limited) private type to the body of his package.
He writes:
>Anyway, I *do* know about the special tricky Ada rule which allows you
>to defer a full type definition until the corresponding package body
>...
>Basically, about the only thing you can do with such objects is to pass
>them as actual parameters to subprograms.  Obviously, if you do this, then
>for each such subprogram, the actual *definition* of the given subprogram
>must be compiled only *after* the full type declaration has already been
>compiled.
>...
>Since any given Ada compiler must generate code to copy scalar actual
>parameters into their corresponding formals, and since the most efficient
>...

Since you have thought so much on the not-so-obvious problem of parameter 
passing, you must have found the answer to the more obvious problem of
heap and stack allocation as trivial. I am probably stupid, because I
fail to see any attractive solutions to that. If in my block I declare:
   A : A_limited_type;
   B : Another_limited;
   C : ARRAY(1..20) OF Yet_another_limited;
If the implementation of the types in available in the specification 
of the types originating package, there is no problem. But if you defer
them to the body, and do not allow cheating with pointers? Enlighten
me, how to you allocate them on the stack? Implicit pointers? Some
implicit size-telling function called at run-time? Not very attractive,
since the place on the stack for other local variables is dependent 
of the size of the types.

To be straight I think that the pointer "trick" serves our needs 
perfectly here, and that your proposal is just YAUAC. (Yet Another 
Unnecessary Ada Change.)
-- 
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.se
"Frequently, unexpected errors are entirely unpredictable" - Digital Equipment

             reply	other threads:[~1988-12-03 23:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-12-03 23:10 Erland Sommarskog [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-04-26  0:00 limited private types r_srinivasan
2000-04-26  0:00 ` Marin D. Condic
2000-04-27  0:00   ` r_srinivasan
2000-04-28  0:00     ` Jean-Pierre Rosen
2000-04-27  0:00 ` Ray Blaak
2000-04-27  0:00   ` r_srinivasan
2000-04-27  0:00     ` tmoran
2000-04-27  0:00 ` Marc A. Criley
1988-11-15 23:28 Ada language revision Wilmer Rivers
1988-11-16 19:06 ` William Thomas Wolfe,2847,
1988-11-18  0:32   ` Ron Guilmette
1988-11-22 14:37     ` Stephe Leake
1988-11-23 13:37       ` Dennis Doubleday
1988-11-29 15:12         ` limited private types Stephe Leake
1988-12-01 23:06           ` Ron Guilmette
1988-12-05  1:48             ` Paul Stachour
1988-12-06 16:56             ` ryer
1988-12-06 20:09             ` stt
1988-12-07 15:51             ` Stephe Leake
replies disabled

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