important proposal: scope keyword for class members

John Simon zildjohn01 at gmail.com
Wed Mar 11 19:50:18 PDT 2009


Sean Kelly Wrote:

> John Simon wrote:
> > 
> > Oh man I've tried, believe me.
> > I couldn't figure out how to call the destructors in-place. Also, structs can't have parameter-less constructors
> 
> Have you tried just calling delete on the reference?  That should do 
> what you want.  In D2 it certainly will at any rate... I haven't looked 
> at the D1 lib source in a while.

That would call __dtor, but wouldn't it also screw up the garbage collector or allocator?  Since the bytes would be located at offset 0 in the struct, wouldn't it try to free the same memory twice?

Also I'm guessing there's no viable solution to the constructor problem, besides a mandatory member function. Which kills a lot of the elegance this type of construct would create



More information about the Digitalmars-d mailing list