Hacker News Comments on
GOTO 2013 • Lambdas in Java: A Peek under the Hood • Brian Goetz
GOTO Conferences
·
Youtube
·
12
HN points
·
2
HN comments
- This course is unranked · view top recommended courses
Hacker News Stories and Comments
All the comments and stories posted to Hacker News that reference this video.Not exactly, lambdas use invokedynamic which has different performance characteristics when compared to anonymous classes.See a talk by Brian Goetz - https://www.youtube.com/watch?v=MLksirK9nnE
⬐ jrs95Great, thank you for the correction. I only knew of what it looked like from an implementation perspective, had no idea things worked differently at runtime.
⬐ phatak-devSeems like Scala going to be enormously benefit from this.
This talk explains why: https://www.youtube.com/watch?v=MLksirK9nnE
⬐ revelationRead "people wouldn't stop harassing us for lambdas after we decided to delay them again and again, and so we half-assed a solution that is easy for us and binds into all the overengineered class hierarchies you have lying around".⬐ BrandonMI believe Hacker News calls this a Minimum Viable Product.⬐ mateuszfMVP and 100% backward compatibility don't go with each other well.⬐ BrandonMThe linked talk actually does a pretty good job describing how Java 8's Lambda is both backwards compatible and forward thinking.1. The idea of @FunctionalInterface leveraged practices that were already in use--interfaces with a single method--for Comparator, Runnable, Callable, and external libraries. This meant that users could use lambdas to implement such interfaces immediately, with no changes to existing libraries.
2. The actual implementation of a lambda in bytecode is a single invokedynamic call. They went that route to avoid tying the bytecode representation to their initial implementation.
A future change could add true function types, and have them automatically instantiate a target functional interface (provided that they have the same "shape"). That would require a language change (adding function types), but not a bytecode change.
That would have the nice result that all the code that people are writing now could work with new function types, and new code could be written to accept the function types instead of functional interfaces. My library would become unnecessary at that point, and I would be pretty happy about that.
That is, Java 8's lambda implementation does not preclude fully-backwards-compatible "real" lambdas in the future.
Personally, I think the Lambda project was a well-reasoned, intelligent step forward. The video is really worth watching, because I wasn't aware of how flexible their future directions are until I watched it.
⬐ mateuszfThanks. But that is totally compatible with what I said. Java lambdas were well thought out, doing MVP style development would highly likely blow it.⬐ frowaway001> That is, Java 8's lambda implementation does not preclude fully-backwards-compatible "real" lambdas in the future.No, it just made them a lot harder to achieve, because any decent "real" lambda implementation requires now the introduction of another language feature: type aliases.