Why do you continue to use D?

Kagamin spam at here.lot
Sat Jun 13 07:04:37 UTC 2020


On Tuesday, 9 June 2020 at 16:33:13 UTC, Stanislav Blinov wrote:
> There's no need for a new interface. What needs to happen is 
> resolution of [1] and amendment to destroy() so it avoids 
> rt_finalize and infers correct attributes. Which, even three 
> years later, I maintain should be resolved by disallowing 
> classes to loosen destructor attributes.
>
> [1] https://issues.dlang.org/show_bug.cgi?id=15246
>
> Until that happens, locally, in your own codebase, you can just 
> have your own variant of destroy() that infers attributes as 
> weakest of all in a given hierarchy. Provided you don't write 
> classes that violate dtor attributes down the inheritance chain.
> So at least this problem can be sidestepped, though I agree it 
> should have a formal resolution in the language and the runtime 
> library.

Destructors should be already @nogc, it's a contract imposed by 
GC itself, it's not formally enforced because destructors predate 
@nogc attribute, but violation of the contract is still a bug in 
user code, so destroy can simply cast destructors to @nogc and 
call like that.


More information about the Digitalmars-d mailing list