Hello.

as there is no possibility to doing GC allocations in class
destructors, wouldn't it be nice to just force "@nogc" attribute on
such dtors?

i know, i know, "this will break alot of code". i'm pretty sure that
this will break alot of INVALID code, which better be broken at
compile-time anyway.

sure, we have alot of code of pre-@nogc era, and alot of code where
authord didn't bother to add attributes at all. so we can introduce
"--force-dtor-nogc" CLI arg and document this change, making it opt-in
for, say, six month and opt-out after that.

and i know that D devs (Walter at least) are resistant to command-line
flags that changing compiler behavior. i don't know how to overcome
this. say, by adding "@gc" attribute, which dfix can automatically add?

but i still believe that instead of telling people again and again that
they should not allocate in class destructors, we can use computer
itself to track and stop this behavior.

let's see how this proposal will be rejected. will there be some sane
reasons, or only the good old song about "broken code"? make your bets!

Attachment: signature.asc
Description: PGP signature

Reply via email to