Comment by uecker
2 days ago
I agree with your point.
But I usually prefer the later anyway, because the code usually is not as nested anyway and having a name is often helpful, and also because I find the nested code with lambdas also not too readable. Other languages have better syntax for chaining functions in this way, i.e. with lambdas I would like to write like this:
foo(arg1, arg2, _)
.(int(int x)) { ... }
.(int(int y)) { ... };
(edit: or something, I think I got it a bit wrong, but you get the idea)
But I agree, sometimes lambdas are better so it would be good to have both.
(There is the classical hack to define lambdas using statement expressions and nested functions.)
No comments yet
Contribute on Hacker News ↗