6 ms·
Go’s mission statement isn’t to be faster than Java or to replace java. Its to (1) compile faster (2) compile into single binaries with no dynamic links (3) nat
by gen220 6y ago
Go’s mission statement isn’t to be faster than Java or to replace java. Its to (1) compile faster (2) compile into single binaries with no dynamic links (3) natively support concurrency and parallelism with M:N routines:threads.
Go will never replace Java for Android because (1) it doesn’t use a VM, so it would need to compile for every arch that android runs on (2) it would require a bug-compatible port of Android. Because Kotlin runs on the JVM and can run on top of Java codebases, it doesn’t have to leap over these hurdles.
There are other reasons you can come up with I’m sure, but those are the biggest that stick out to me. Notably it has nothing to do with “which language is better”.
They optimize for different use cases, and that’s OK. That being said, if you were writing Android from scratch and were only targeting ARM (an equally silly comparison meant to highlight the differences in the languages), you’d be hard pressed to justify Java over Go.
- apta 6y ago> (1) compile faster This isn't really true for non-trivial code bases. And even if it is, it's not a big difference in practice, especially with incremental compilation where I find it actually much quicker to change a couple of files and re-run unit tests compared to golang which has to spit out a multi-dozen MB binary each time, taking 5-6+ seconds. > (2) compile into single binaries with no dynamic links Java is getting AOT compilation which will do the same. > (3) natively support concurrency and parallelism with M:N routines:threads. Java is getting those as well: http://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html http://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.h...
- pjmlp 6y agoJava on Android compiles to native code just like Go. Google is writing Android from scratch, is it called Fuchsia and Go also doesn't get to play there. The few parts that were written in Go are scheduled to be rewritten in C++ or Rust, with Dart being the main userspace language.
- Groxx 6y agoI honestly have yet to see any evidence that Fuchsia is anything but an experiment in this respect, like Dart was (which was also going to "replace android"). I entirely admit the possibility, but I see no plan. Hopes and aspirations are not plans.
- pjmlp 6y ago> That being said, if you were writing Android from scratch and were only targeting ARM (an equally silly comparison meant to highlight the differences in the languages), you’d be hard pressed to justify Java over Go. Instead they went with Rust, C++ and Dart. Now what have all those languages in common that Go lacks?