Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Assuming it's really gaining momentum over Scala I won't understand why. What Kotlin has over Scala? Compile times? After coding for 1 hour I compile once to check if Intellij and I missed something. Are those 3-4 minutes too much time?


Well, that's the thing. If you have a small amount of code, the compile times are never a problem. Try compiling something like Apache Spark. It will be somewhere between 30-60 minutes depending on your disk speed, CPUs, etc. etc. The incremental builds are faster, but never less than 2 or 3 minutes for any change. You could potentially avoid this with the REPL, or use inotify to trigger a background compilation, but none of those really works all the time.


And yet it was written in Scala. That shows how little the compile times offset the goodies of using Scala.


At the time Spark was started, Java didn't have lambdas or closures, making the equivalent Java code for functional-programming-style ML code much more verbose. Whether the same decision would be made today is an open question (and probably depends on who you ask). A lot of other frameworks have made different decisions, such as keeping the core of the project in Java and supporting other languages as shims on top (in my opinion a more sensible decision...)


To me, the benefit is what Kotlin has less than Scala.

It's an incremental improvement over Java and it fixes exactly all the complaints I have over Java and nothing more.

Also, its IDE support is just as good as Java.

But the language is not even out officially, let's see in five years how it fares. Right now, it's just a breath of fresh air over Java.


From what I observed it's close enough to Java that people can easily switch and are willing to. There's also enough brevity with the language to be at ease with it daily (not as much as Scala) where it may be enough that perhaps people might not want to invest time to go all the way to Scala.


One of the things I love about Scala is that you don't have to "go all the way" though - you can start by writing Java-like code using Java libraries, and move on to writing Kotlin-like code as and when you want to, and move on to more advanced features than that as and when you want to.


> One of the things I love about Scala is that you don't have to "go all the way" though

This is true of any language so it doesn't mean much.

Still, we went through the same thing with C++ 20 years ago. Google even used to have (still does?) a style guide saying which features to use and which ones not to use.

Instead of having to use a guide that tells me which features of a language are dangerous, I prefer a language that doesn't require such a guide in the first place.


Unfortunately it's impossible to combine that with seamless Java interoperability, because so many Java features are dangerous (null, exceptions, pervasive mutability, all of the methods on Object, finalizers, low-level thread manipulation) or at least cumbersome (use-site variance and the resulting existential types, control flow constructs built into the language syntax).

I don't think there are any dangerous things you can do in Scala that you can't do in Kotlin. Only safe alternatives that exist in Scala but not in Kotlin.


> Google even used to have (still does?) a style guide saying which features to use and which ones not to use.

Which is a good example on how not to write modern C++, given the things they don't allow to use and not loved that much in the C++ community.


Right now, I would say the only thing it has is momentum on Android, given JetBrains relation to Studio.

Using Scala on Android requires a bit more tinkering with ProGuard than Kotlin does, and it isn't a focus of the Scala designers.

Also with Scala 2.12 going Java 8, one will be stuck with 2.11 for Android.


2.12 doesn't include any (non-gated) changes though, so you can keep the same codebase and cross-build for 2.12 (for performance) and 2.11. So we're talking what, at least 3 years ("Aida", either 2.13 or 3.0) before Java 8 becomes a blocker for source-level features, at which point I imagine Android will have an answer.


I doubt Google team will change, given their attitude regarding Java 8, as demonstrated at both Google IO 2014 and 2015.

Also the way they are cherry picking features from OpenJDK 7 and some kind of lambda support.

For me, Android Java has become similar to Symbian C++ in terms of dev experience and language fork.


No Android will switch to newer OpenJDK so Scala 2.12 would be a valid target.


Spend some time reading the Android source code.

According to Jake Warton, they only cherry picked some parts of OpenJDK 7.

From the commits they also don't appear to ever fully support Java 8, only lambdas.


ever is a strong word. I know that at the moment they use some parts of OpenJDK 7, but If they need to comply the Java (tm) caused by licensing, they will be forced (sooner or later) to actually don't use a deprecated JVM. As I know OpenJDK will be depracted on 2024. so it will take some time, but it will come.


Given the rumors of ChromeOS and Android becoming one OS, by 2024 it will hardly matter.


It's worth noting that typesafe are prioritizing reducing compile time but it's a 32 pass compiler (!)

We're working on gigantic production systems currently and with good modularization compile times are not a problem for us.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: