auto classes and finalizers

Don Clugston dac at nospam.com.au
Mon Apr 10 08:00:20 PDT 2006


Mike Capp wrote:
> In article <e1dak2$21d9$1 at digitaldaemon.com>, Bruno Medeiros says...
>> Protection attributes and casts add usefulness (not gonna detail why).
> 
> The usefulness of protection attributes lies solely in preventing you from
> misusing something. Same with auto and dtors. If a class needs a dtor, leaving
> it to the GC qualifies as misuse in my view.
> 
>> Forcing all classes with destructors to be auto classes, on the other 
>> hand, severily limits the usage of such classes. An auto class can not 
>> be a global, static, field, inout and out parameter. It must be bound to 
>> a function, and *cannot be a part of another data structure*. This 
>> latter restriction, as is, is unacceptable, no?
> 
> Agreed; IIRC, auto members of auto classes were part of my original suggestion,
> and I think the dtors-for-autos-only restriction would quickly force this
> problem out into the open.

I suspect that if finalisers were abolished, those other restrictions 
would be MUCH easier to lift. They probably exist mainly because of the 
complexity of the interactions with the GC.

> 
> It may be that we're agreeing on the destination and only differing on how to
> get there.
> 
> cheers
> Mike
> 
> 



More information about the Digitalmars-d mailing list