On Tuesday, 11 April 2017 at 11:08:34 UTC, Dukc wrote:
This idea could be generalized:

-DRuntime would add an interface "ReferenceCountable".
-Throwable would implement it.
-When a new expression of ReferenceCountable type is used to assign to a scope variable or argument, it's guaranteed to be @nogc.

scope c = new Object;

This should be recognised as a scope class instance. It doesn't need reference counting, as it should always be destroyed at the end of current scope. The compiler can allocate on the stack (if the instance isn't too big):

https://forum.dlang.org/post/mailman.1045.1471418257.3131.digitalmars-d-annou...@puremagic.com

If it is too big, the compiler could use a @nogc heap allocator.

Reply via email to