Hi,
the confusion starts here: http://dlang.org/function.html#closures
End of paragraph bellow the last delegate example:
"This combining of the environment and the function is called a dynamic closure."

While according to https://en.wikipedia.org/wiki/Scope_%28computer_science%29 "Lexical scope vs. dynamic scope" I would call D delegates lexical closures, as the scope of the callee (scope where callee is defined) is used for free variable lookup, isn't that right?

Confusion is enhanced with this Dlang wiki: http://wiki.dlang.org/Function_literals "This has brought up the specter of Dynamic Closures. The nested and/or anonymous functions can only access dynamic scope, which means scope that exists on the stack at the time of execution. This differs from lexical scope, which refers to the scope as indicated by the program text structure."

So what's what now?

Cheers, ParticlePeter

Reply via email to