Hacker News new | ask | show | jobs
by Chris2048 3540 days ago
> jump around the source code

A named function should be easier to track due to it being named, and properly defined in one place.

I believe debugging can be harder when you see some random anonymous function and have no idea where it is defined (because, I think, lambdas don't hold their definition line-nos?)

Since we're talking about multi-line functions, the added verbosity wouldn't be a lot. Additionally, you would be forced not to nest functions too much.

> why static analysis can't handle closures

Would it require tracking run-time state/modifications to the closure?

> I want to use expressive constructs as a programmer, not be arbitrarily limited by what some static analyzer can handle.

You could argue the same for any language with types - why should I be limited by the constraints of the type system?

Because it's easier to verify the code, and it doesn't actually limit what's possible to develop, only how it must be developed (in a more explicit style).

I see it as putting an extra burden on the developer, which makes it harder for sure, much as writing tests puts an extra burden on the developer.

> why they can only be one expression

http://www.artima.com/weblogs/viewpost.jsp?thread=147358

Seems like it is mainly a technical decision.

> I don't want to limit my expressiveness because of some technical issue in a language

I feel this is a problem with js (versus, say, Java) - faster to write, harder to analyse. What's so important about expressiveness that you wouldn't want the code easier to maintain?

> Many languages implement closures efficiently

I can't really complain about this wrt Python when I'm not sure what it would add. Even if lambdas could be multi-line, I would not want to use them for sake of their parameter-binding semantics - in fact, I consider it a python gotcha. I