From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43aafc250d42730f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-07 07:40:06 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: Ted Dennison Newsgroups: comp.lang.ada Subject: Re: controlled type in generic package? Date: Wed, 07 Feb 2001 15:28:49 GMT Organization: Deja.com Message-ID: <95rpj5$gq7$1@nnrp1.deja.com> References: <3A7FDA9A.C667090F@stn-atlas.de> <95p2ab$463$1@nnrp1.deja.com> <95q1fa$9e$1@usenet.rational.com> NNTP-Posting-Host: 204.48.27.130 X-Article-Creation-Date: Wed Feb 07 15:28:49 2001 GMT X-Http-User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; 0.7) Gecko/20010109 X-Http-Proxy: 1.0 x69.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 X-MyDeja-Info: XMYDJUIDtedennison Xref: supernews.google.com comp.lang.ada:4929 Date: 2001-02-07T15:28:49+00:00 List-Id: In article <95q1fa$9e$1@usenet.rational.com>, "Mark Lundquist" wrote: > > Ted Dennison wrote in message > > Also, any instantiations of this generic will have to be done at the > > library level, since Limited_Controlled is declared at the library > > level, and types can't be declared at a lower level of scope than > > their parent types. ... > > (As a user, I hate that rule.) > > Do you hate it as much as what might happen if it weren't for the > rule? :-) I have to admit I'm a little unclear as to what nasty things could happen to me if I were allowed to declare a derived tagged type at a lower scope level than their parent type. The worst I can see that some objects that are pointed to in a classwide aggregated data structure might go invalid if I have things badly programmed. Since none of the Ada compilers I use have garbage collection (and I can't use controlled types as a general solution), I have to worry about deallocation issues anyway, so its not like this is really saving me from anything. On the other hand, I loose the ability to make use of the safer controlled types in all but the most restrictive of circumstances. This is not a theoretical issue; Its prevented me from using controlled types in quite a few situations. In a very real sense, the baby got thrown out with the bathwater. So perhaps this is just my ignorance speaking, but yes, I do hate it more. Of course there's nothing saying that there couldn't have been a solution that keept the rule, but allowed non-library-level controlled types. This whole situation is just an unfortunate side-effect of the implementation method chosen for controlled types, and has nothing to do with controlled types themselves. As such, I think its clear its a *bug* in the Ada spec, which hopefully will be fixed in the next serious revision. Making Ada.Controlled a generic would seem an obvious solution (if a bit of a hack), but I'll leave the actual fix up to those who are good at that sort of thing. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/