Hacker News new | comments | show | ask | jobs | submit login




your parent is suggesting that java does not have a substitute for lambdas.


Which isn't true anyway, since anonymous inner classes are just very verbose and awkward lambdas. (I'm a Java hater but I'm also a horrible pedant)


True. Then again, what's the practical point of lambdas that aren't concisely expressed?


There are plenty of practical uses: http://code.google.com/p/guava-libraries/wiki/FunctionalExpl...

Note that the Guava lib specifically points out how ugly this is.

I prefer Clojure.


What's the decision procedure for whether a certain expression is "concise?"


Horrible as in "no good" pedant?

Because, no "anonymous inner classes" are no lambdas. They are, well, classes kludgily used to mimic a lambda proper.


What it is to be 'a lambda' isn't particularly well-defined. If we define it to mean an anonymous closure then Java certainly has them — so long as its free variables are final (it closes over references). On the other hand, if we define it as the operator which creates anonymous closures, then Java doesn't, because you have to actually build the closure by hand.

Since the former have a proper name (closures) and the latter doesn't, I'd be inclined to call only the operator a 'lambda'. But since you can at least 'approximate' closures in Java (with anonymous inner classes), I think it's fair to say that they are "very verbose and awkward lambdas", to some definition of lambda.


lordlicorice (the ggp of my post) suggested that there is "no substitute for lambdas" and I was intending to correct that. Anonymous inner classes are definitely a substitute.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: