callback craziness
    Adam D. Ruppe via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun Aug  7 16:04:58 PDT 2016
    
    
  
On Sunday, 7 August 2016 at 23:02:26 UTC, ag0aep6g wrote:
> Not exactly. When you do something that requires a closure, it 
> errors out. As I said, a delegate doesn't always require the 
> allocation of a closure.
You can also throw scope in there iff the delegate will never be 
stored:
@nogc void foo(scope void delegate(int x) @nogc f) {}
Then it won't allocate the closure even if it is a context that 
usually needs it, but if you store it then, you are liable to 
memory corruption.
    
    
More information about the Digitalmars-d-learn
mailing list