5 ms·
I like to think of lambdas as the hook that shows Java developers how Scala can help their code but its other features are what make them stay. As the article
by saryant 13y ago
I like to think of lambdas as the hook that shows Java developers how Scala can help their code but its other features are what make them stay.
As the article says, "type inference, traits, vals, implicits, case classes, value classes, static objects, pattern matching, type variance, macros, immutable datatypes, lazy vals, existential types, higher-kinded types, type classes".
(Pattern matching is amazing, I don't know how I lived without it)
- justinsb 13y agoAgreed: there's definitely still more features in Scala. But Java has taken "Scala - the good parts"; or at least, what they consider the good parts. That'll be enough for many people, and my guess is it will suck the air out of Scala's room. I do consider some of those other features important, and wish we could have them in Java, but they aren't as well-proven yet. (For me, it is easy immutable classes; I like pattern matching but can cope without it.)
- eranation 13y ago> But Java has taken "Scala - the good parts"; I respectfully disagree. if anything did that, it was Kotlin.
- deleted 13y ago[deleted]
- lomnakkus 13y agoI think it's more that they've taken one good part, but in their defense it's probably one of the best parts :). Pattern matching and specifically algebraic data types are probably the most important to me since I find algebraic data types to be such an incredibly powerful data modeling tool. I find that almost any problem I encounter in my daily work can easily be modeled using algebraic data structures and from there the code is always some set of "trivial" set of pure pattern matching functions. Unfortunately the full power of pattern matching (compiler-checked exhaustiveness/consistency checks, specifically) can only really be emulated with the visitor pattern in Java -- which is just too much boilerplate syntax to make it useful outside of special cases.
- EdwardDiego 13y agoI loathe implicits with the heat of a thousand suns. I mean, I love implicit conversions for easy addition of syntactic sugar, but they should be used very sparingly. It could just be my indoctrination into Python's more of Explicit Over Implicit, but I hate it when things mysteriously turn into things or get passed as implicit arguments because something was in scope. My most hated form is nested implicit conversions, it kills code readability immediately if you can't figure out what type or object actually got passed in. And I'm using IDEA btw, so about as much tooling on hand to interpret said code as I'm likely to get. Of course, you don't have to use implicits, but so much idiomatic Scala code (if I can interpret Typesafe's output to indicate idiomatic Scala) uses it, so I guess it's here to stay. I do love the pattern matching though, especially when it's destructuring.
- eklavya 13y agoYou do know implicit conversions are marked by underlines, (both in IDEA and Eclipse) right?
- EdwardDiego 13y agoYes, but when an implicit conversion has been applied to an implicit conversion has been applied to a... ...well, underlining it helps but can't convey all that has gone on.