On 29/03/18 14:03, Maksim Fomin wrote:
On Thursday, 29 March 2018 at 09:45:04 UTC, Shachar Shemesh wrote:
Not so long as destructors don't reliably run.
$ rdmd test.d
A(1) constructed
A(2) constructed
A(1) destructed
Caught: Constructor failed
https://issues.dlang.org/show_bug.cgi?id=14246
Good catch. This is a variant of bug reported 5 years ago. The funny
part of this bug is that the fix was reverted ... because of excessive
code breakage.
I like D pretty much and wish to use it in serious code, but I cannot
tolerate such sort of things.
I don't think the fix was reverted because fixing the bug breaks code. I
think the fix was reverted because *it* broke code.
The fix made way too many assumptions that were simply not universally
true. For example, it would not work with structs with @disable init or
@disable this().
So, yes, the way D is built it is not easy to properly fix it. That does
not mean it shouldn't be fixed.
Shachar