3 ms·
Any details on variable capturing from outer scope? The same as C# (apparently capture all variables?)?
by zokier 15y ago
Any details on variable capturing from outer scope? The same as C# (apparently capture all variables?)?
- zbowling 15y agoyes, closures are implied. lambda's are almost useless without closures being included.
- artsrc 15y agoI think the difference between capturing values at call time and full closures only matters if you are mutating variables, which my closures rarely do, since my code is fairly functional'ish, so for me it does not matter.
- zokier 15y agoI'm more familiar with C++ lambdas, and in those you must specify how you will capture variables (no capturing, by reference, by value, or some mix of those).
- colanderman 15y agoPresumably it would work identically to inner classes (only captures final variables, so value/reference doesn't matter).