90 points · by belovrv · 10y ago · 37 comments
Of course, there's still plenty of room for both languages, and I'm sure Kotlin will introduce interesting innovations of its own.
So thinking of it as a one dimensional line isn't really correct. Kotlin and Scala overlap in many ways, but the ways in which they don't (and will not) define them.
I constantly see Kotlin advocates claiming better Java interop but I don't see how; Scala already has 100% Java interop as far as I can see.
For instance, Kotlin is using the same collections library as Java. So there are no adapters or conversions needed. Scala has its own collection library instead.
Scala has some constructs that can make it impossible or very difficult to call code from Java. Kotlin doesn't.
I think generally when people say this they mean things like:
1. You can freely mix and match Java and Kotlin files in the same package
2. Being a more lightweight layer on top of Java makes interop with all Java environments (specifically Android) more practical
Honest question - what is it that makes Scala's optionality inefficient compared to Kotlin? I'd never heard of this before.
Kotlin treats nullability as an ad-hoc special case. This allows them to save those 8 bytes occasionally, but it means you simply can't handle optionality generically (in Scala you can write methods that will work generically with Option and also with other cases, e.g. "sequence" does the same thing when you call it on a List[Option[Int]] or a List[Future[Int]] or a List[Writer[String, Int]] or... and it all makes sense, because Option is just another plain old type in the language). IMO that's the wrong tradeoff for almost all use cases, but evidently the Kotlin folk disagree.
I haven't programmed Kotlin before, so I'm not sure what their answer to implicits is. For ad hoc polymorphism, none of the alternatives is particularly pretty. Perhaps the current answer is to resort to adapter classes, which would be the way to do it in Java.
I feel that part of Scala's problem in every project I've been involved with is that it has too many features which means if you're not incredibly careful about specifying exactly what features should be used you end up with an unmaintainable mess.
Whenever I've asked people to go into the specific "too many features" in Scala it always turns out they were talking about library features, not language features. The language is powerful enough that people can write very complex libraries in it. If Kotlin ever becomes popular it will have exactly the same problem.
The funny thing is that even as people say that, every new release tends to look a step closer to Scala.
Note that we’re still in the process of estimating
the effort needed to implement this feature,
and we don’t know whether it would be reasonable
to support it in the 1.1 timeframe or it would be
postponed to a later release.
:) I can already tell you: yield is probably doable, async-await will have to be postponed.if yes, then i would assume the primary objective should be performance .. but this doesnt seem to be the case
and my question is, is there any jvm language which is faster than java
OTOH some languages make it more practical / cheaper to write higher-performance code, e.g. in Scala you can use @specialized to automatically generate unboxed special cases for generic code that you'd have to write (and keep track of) by hand in Java. But if you ask "in which JVM language is it most practical/cheapest to write feature X with performance Y?" then the biggest component of the answer is going to be how easy programming in general in that language is, not anything specific to performance.
The question "how fast will a naive implementation in language X perform?" does have an answer, but it's not a question you should ever be asking - if a naive implementation in language X is faster than a naive implementation in language Y, but takes 3x as long to write as an optimised implementation in language Y that's faster than the naive implementation in language X, then language Y is the better choice.
The advantage is that it makes code written in a functional style effectively free (well, almost, unless you could gain performance from step fusion). The disadvantage is that the JVM wasn't designed for that and it messes up stack traces.