comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: controlled type in generic package?
Date: Wed, 07 Feb 2001 16:29:17 GMT
Date: 2001-02-07T16:29:17+00:00	[thread overview]
Message-ID: <Pine.BSF.4.21.0102070808080.11964-100000@shell5.ba.best.com> (raw)
In-Reply-To: <95rpj5$gq7$1@nnrp1.deja.com>

On Wed, 7 Feb 2001, Ted Dennison wrote:
> In article <95q1fa$9e$1@usenet.rational.com>,
>   "Mark Lundquist" <mark@rational.com> wrote:
> >
> > Ted Dennison <dennison@telepath.com> 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.

I think that there is definitely a "usability" issue about Ada concerning 
nesting. In the AI on limited access types Bob Duff discussed allowing 
nested derivations as a substitute for funargs, just empowering the 
standard object as function trick. 

Tying Controlled to derivation has definitely been a pain for me as a
user too. I imagine it's less of a pain to C and C++ programmers who use Ada, 
since if you're used to "flat" languages you can program in "flat" Ada and 
you're mostly OK. It's a bit of a bummer when writing collection libaries
since if you make your collections controlled you pass on those
restrictions. 

I bet people who really get used to (a lexically scoped (not Emacs)) Lisp
or a modern functional language find this more irritating, because some
natural programming styles in those languages make use of nesting that
Ada doesn't have, just like people who get used to overloading in Ada
really miss it in ML. 

-- Brian






  reply	other threads:[~2001-02-07 16:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-06 11:06 controlled type in generic package? Nils Priebe
     [not found] ` <slrn97vtf5.ho.lutz@taranis.iks-jena.de>
     [not found]   ` <95q19j$9d$1@usenet.rational.com>
2001-02-07 10:11     ` Lutz Donnerhacke
2001-02-07 21:57       ` Mark Lundquist
     [not found]   ` <95p2ab$463$1@nnrp1.deja.com>
2001-02-07 15:08     ` Jean-Pierre Rosen
2001-02-08 15:41       ` Ted Dennison
2001-02-08 18:21         ` Jean-Pierre Rosen
2001-02-08 16:31       ` Florian Weimer
2001-02-08 21:10       ` Brian Rogoff
2001-02-09 10:39         ` Florian Weimer
2001-02-09 17:02           ` Brian Rogoff
2001-02-09 18:45             ` Florian Weimer
2001-02-13  0:32           ` Nick Roberts
2001-02-14  0:30             ` Jon S Anthony
     [not found]               ` <x7vg0hd20cm.fsf@smaug.pushface.org>
     [not found]                 ` <hovk6.96$aw5.304@www.newsranger.com>
2001-02-23 20:50                   ` Simon Wright
     [not found]     ` <95q1fa$9e$1@usenet.rational.com>
2001-02-07 15:28       ` Ted Dennison
2001-02-07 16:29         ` Brian Rogoff [this message]
     [not found]           ` <3A82A66D.49DE7EBD@bton.ac.uk>
2001-02-08 15:15             ` Robert Dewar
2001-02-08 16:56             ` Florian Weimer
2001-02-09 10:25               ` John English
2001-02-09 19:46                 ` Brian Rogoff
2001-02-07 18:52         ` Pat Rogers
2001-02-07 19:23           ` Pat Rogers
2001-02-07 19:50             ` Ted Dennison
2001-02-07 22:52         ` Jean-Pierre Rosen
2001-02-08  9:36           ` dmitry6243
2001-02-09  8:51             ` Jean-Pierre Rosen
2001-02-09 12:28               ` dmitry6243
2001-02-08 19:58           ` Mark Lundquist
2001-02-10  9:54           ` Thomas Wolf
replies disabled

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