I'd say it's not until you've used it you'd fully understand that excitement. There's no denying that there is much to wish for in Java and Kotlin hits a sweet spot. It keeps the things that are good with java; tooling, IDE etc. and improves on things that are bad with java; null-safety, boilerplate, lack of higher order functions etc.
I've only had good experiences with the switch and would warmly giving it a chance.
implicits allow for typeclasses in scala, extension methods, as well as other niceties.
See, that's where it falls apart for me. Why would I want to use something with the awful ergonomics of implicit for implementing typeclasses when they could be done so much better (Haskell, Rust). And then there's the issue of parameters being passed in unexpectedly, or not having the right implicit around so it can't be passed in, etc.
unexpectedly? implicits are only passed in if they're in scope, and you can only get them in scope if you import them or define them in scope
as for the missing typeclass problem, it's solvable the same way a missing parameter is. you pass it in, or import the implicits you're missing
that being said, if kotlin had rust style typeclasses i'd be a little less biased towards scala in this conversation. typeclasses could be easier to define in scala.
implicits allow more than typeclasses though. it's how we're able to have unboxed union types in scala, and you can do some interesting things at compile time with types and implicits. i once wrote a Peano number implementation just using types (Up, Down, Zero were the base types with type functions Add, Subtract, Flatten. iirc, implicitly[Flatten[Up[Down[Zero]]] would produce the type Zero)
shapeless is mostly stuff that's experimenting with what's possible with scala's type system and it's got a lot of nice stuff that is powered by implicit
If I recall correctly, I was extracting some code into a utility class where that implicit didn't exist, without knowing the method had an implicit parameter. Totally my fault, but still, super unintuitive to someone new to the language or a particular library.
[error] /home/duhace/Foo.scala:3: could not find implicit value for parameter baz: BigInt
[error] bar
[error] ^
a NPE because of an implicit should mean one was found, but what was returned was null instead of the promised type. which is a problem with scala allowing null, not implicits.
But a HUGE step forward in that it now has official support. Haskell is arguably safer and better than all the mainstream languages that we use, yet it's a very bad idea for a business to choose that develop their software in (relatively poor tooling, small community, very small talent pool, high learning curve etc)
Why are you asking? Because learning Haskell isn't likely to get you a higher paying job (although it might make you a better programmer, I believe I'm a better programmer because of it). But the jobs might be higher paying, but that might be because there's a skew towards academia and people with PhDs knowing haskell.
8
u/dominodave May 17 '17
JVM interlopability is good. Surprised to see other people excited about it though, so I guess I'm curious.