comp.lang.ada
 help / color / mirror / Atom feed
* Re: derived types in package specs
@ 1989-04-21 23:12 Ken Anderson
  0 siblings, 0 replies; 4+ messages in thread
From: Ken Anderson @ 1989-04-21 23:12 UTC (permalink / raw)


>  This disallows things like
>     type this is new integer;
>     type that is new this;

   The rationale behind this is due to the fact that a derived type receives
it's parents subprograms. I.E. ALRM 3.4(13):

   "The specification of a derived subprogram is obtained implicitly by 
    systematic replacement of the parent type by the derived type in the
    specification of the derivable subprogram..."

Thus because your context is in the package specification, before you can 
derive a new type from this (taken from the example above), all of the
subprograms (and subtypes, expressions, ...) that use type this, must be 
defined. The compiler will not know that all of these have been defined until
it has finished compiling the spec. This insures that everything that must
be derived for a new type is known.


package That is

   type this is new integer;

end That;


------ In some other unit,

with That;
procedure Who is

   type that is new That.this;

begin
   null;
end Who;




Ken Anderson
U.C. Irvine
Go Anteaters!

^ permalink raw reply	[flat|nested] 4+ messages in thread
* derived types in package specs
@ 1989-04-20 17:34 Alex Blakemore
  1989-04-23  1:50 ` Orville Weyrich
  1989-04-24 15:27 ` Robert Eachus
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Blakemore @ 1989-04-20 17:34 UTC (permalink / raw)



  Does anyone have an idea of the rationale behind RM 3.4(15) ?

  "If a derived type or private type is declared immediately within
   the visible part of a package, then, within this visible part,
   this type must not be used as the parent type of a derived
   type definition." ... see also 7.4.1.(4)

  This disallows things like
    type this is new integer;
    type that is new this;

  and what really hurt was
    type this is private;
    that that is new this;

  The draft copy of the Ada design rationale doesn't seem to discuss this.
  If this were legal, I think I could come up with a very nice use for
  derived types (something that has been rare but not unheard of in my experience)
  So there must have been a reason right ?

                                  Alex Blakemore
                                  Software Productivity Consortium
                                  blakemore@software.org

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

end of thread, other threads:[~1989-04-24 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1989-04-21 23:12 derived types in package specs Ken Anderson
  -- strict thread matches above, loose matches on Subject: below --
1989-04-20 17:34 Alex Blakemore
1989-04-23  1:50 ` Orville Weyrich
1989-04-24 15:27 ` Robert Eachus

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