Discussion Thread: DIP 1033--Implicit Conversion of Expressions to Delegates--Final Review

rikki cattermole rikki at cattermole.co.nz
Fri Nov 20 09:49:15 UTC 2020


On 20/11/2020 9:06 PM, Manu wrote:
> So, the thing that makes me nervous about this DIP, is that it may 
> substantially proliferate allocated closures.
> I would want to have high confidence that people exclusively use `scope` 
> delegates, such that the closure can (will?/must?) be stack allocated.

One way to do this would be to add a new compiler check: @localnogc (can 
call methods that are not @nogc, but cannot do any direct calls to GC 
like new (apart from exceptions)).

It is something that has been on my mind for a while now. But that 
wouldn't help for forcing the caller You'd still need to use scope on 
the parameter.


More information about the Digitalmars-d mailing list