3 ms·
A lambda that does not close over its environment is not really a true lambda. It's just a normal function with function scope. I suspect we have some differen
by kccqzy 7y ago
A lambda that does not close over its environment is not really a true lambda. It's just a normal function with function scope. I suspect we have some difference in terminology difference: what I call lambda is what you call nested functions. I hate it when there are those kind of trivial terminology differences.
- shakna 7y agoYou can do that with this. Because it does technically contain a nested function called _ it's just GCC usually makes that function a normal function if it contains no variables from the parent's scope. If you reference the outer scope inwards, however, you will end up with an executable stack. And you won't have a borrow checker to tell you the the value that the lambda mentions is no longer at the same address. In fact, you have no flags to warn you of that event. C++ has lambdas. GNU-C has a hack that is truly terrifying to behold if you use it to the full power.