Destroying structs (literally)

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 28 19:45:47 PDT 2014


On Friday, 29 August 2014 at 02:21:07 UTC, Andrei Alexandrescu 
wrote:
> Dear community, are you ready for this?
>
> https://issues.dlang.org/show_bug.cgi?id=2834
> https://github.com/D-Programming-Language/druntime/pull/864
>
> We must do it, and the way I see it the earlier the better. 
> Shall we do it in 2.067?
>
> This is a significant change of behavior. Should we provide a 
> temporary flag or attribute to disable it?

It will _fix_ a lot of code, I expect, whereas it will probably 
break very little. The main thing that it would break would be if 
there's any GC heap allocation in a struct's destructor, but that 
will only matter if the struct is on the GC heap, and I think 
that it's something that we're pretty much stuck with. Certainly, 
that's not much of a loss in comparison to all of the bugs 
created by stuff like an array of std.stdio.Files. Maybe there's 
a problem if someone was manually destroying stuff? But if so, I 
don't see how we can avoid breaking their code. And they'll 
probably be much happier with this change just so long as they're 
aware of it, and hopefull the changelog is enough for that.

So, I'd say to put it in 2.067. I don't think that waiting buys 
us anything.

- Jonathan M Davis


More information about the Digitalmars-d mailing list