comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: library level required or not?
Date: Mon, 01 Mar 2004 21:36:03 -0500
Date: 2004-03-01T21:36:03-05:00	[thread overview]
Message-ID: <jpidnZMQDrGJbt7dRVn-ug@comcast.com> (raw)
In-Reply-To: <x7vu118cofj.fsf@smaug.pushface.org>

Simon Wright wrote:

> (I also see (4), "A type extension shall not be declared in a generic
> body if the parent type is declared outside that body." I think ISNBAL
> -- I shall never be a lawyer)

This rule seems very mysterious, but it is actually a simple rule! 
Well, simple compared to the alternative.  There are many weird things 
that you could do if this rule wasn't there.  Rather than have a dozen 
exceptions to other rules, this one rule takes care of all of them.

If you really need a type extension in a generic body, you can put the 
extension declaration in the private part of the package specification. 
  This way (necessary) checks can be made at the point of any 
instantiation.  If they succeed, fine.  If not the instantiation is 
illegal.  But the Ada model doesn't allow rejecting an instantiation 
because of declarations in the body of the generic.

Extending a type declared in the generic body itself can never cause a 
problem because the legality of those declarations can't depend on the 
characteristics of a generic formal parameter.

-- 
                                           Robert I. Eachus

"The only thing necessary for the triumph of evil is for good men to do 
nothing." --Edmund Burke




  parent reply	other threads:[~2004-03-02  2:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200403011717.22528.maa@liacc.up.pt>
2004-03-01 18:49 ` library level required or not? Marius Amado Alves
2004-03-01 18:41   ` Preben Randhol
2004-03-01 19:21     ` Marius Amado Alves
2004-03-01 20:17       ` Simon Wright
2004-03-01 23:32         ` Marius Amado Alves
2004-03-02  2:36         ` Robert I. Eachus [this message]
2004-03-01 17:17 Marius Amado Alves
2004-03-01 23:37 ` Randy Brukardt
2004-03-02  0:21   ` Marius Amado Alves
replies disabled

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