4 ms·
C# anonymous functions are true lexical closures, if that is what you are asking.
by olavk 18y ago
C# anonymous functions are true lexical closures, if that is what you are asking.
- ajross 18y agoHunh. Yuck. So how does that work at the instruction level? It seems like the generated code needs to take one of two wildly divergent paths depending on whether or not a scope includes a lambda or not. Either that, or you need to malloc the stack frame of every function that gets called, which is equally a mess.
- orib 18y agohttp://people.debian.org/~aaronl/Usenix88-lexic.pdf http://people.debian.org/~aaronl/Usenix88-lexic.pdf ddescribes non-escaping lexical closures for C++. With a bit of work (automated clone-env-on-escape, for example) you can have efficient closures that don't totally suck.