comp.lang.ada
 help / color / mirror / Atom feed
From: chris <spamoff.danx@ntlworld.com>
Subject: Re: Deallocation & Tagged Types
Date: Sun, 19 Oct 2003 17:53:09 +0100
Date: 2003-10-19T17:53:09+01:00	[thread overview]
Message-ID: <8ezkb.5981$mM1.925@newsfep4-winn.server.ntli.net> (raw)
In-Reply-To: <3F92AFF6.8050001@comcast.net>

Robert I. Eachus wrote:
> 
> This is what Controlled types were added to the language for, why aren't 
> you using them?  In your example, if Vehicle is a controlled type, you 
> don't have a problem.  If Vehicle has no required finalization, it 
> doesn't need to be derived from Controlled (or Limited_Controlled) but 
> again, as the programmer of an abstraction that uses Vehicle, you don't 
> have to worry about it.

In the real code, the types *are* controlled.  The problem was how to 
get rid of X when X is of type access to Vehicle'Class, not how to tidy 
up X after use when it is a Vehicle.  I wasn't clear sorry.

I tried instantiating Unchecked_Deallocation on Vehicle and not 
Vehicle'Class not knowing you could do that.

> (Note:  I understand that if someone programs an abstraction 
> incorrectly, that is a problem.  But it is also a bug in the ADT that 
> needs to be fixed there.  Code that includes workarounds for bugs in the 
> ADTs used is twice wrong.  Once because the original type should be 
> corrected, and the second time because fixing the base abstraction is 
> now going to create a follow-on bug.)

Yes the ADT abstraction was broken, but only after trying to get around 
the problem of deallocating the access component in the record.  The 
ugliness is (IMO) gone now.


Chris




  reply	other threads:[~2003-10-19 16:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-18 20:53 Deallocation & Tagged Types chris
2003-10-19 15:38 ` Robert I. Eachus
2003-10-19 16:53   ` chris [this message]
2003-10-20  1:08     ` Robert I. Eachus
2003-10-19 16:10 ` Dmitry A. Kazakov
2003-10-19 16:50   ` chris
2003-10-20  1:13     ` Robert I. Eachus
2003-10-20  1:43       ` Hyman Rosen
2003-10-26  8:11 ` Patrice Freydiere
replies disabled

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