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

It's very sad that our industry is so hype driven.

Nothing really changed, you could write Android apps on Kotlin before, as well as on any other JVM language. But now "Kotlin is the hero".

I suspect that Google's adoption of Kotlin is just politics: JetBrains develops Android Studio for Google, so they pushed Kotlin as part of the deal. Google could acknowledge Scala years ago, but didn't, because Scala authors spend less time on bullshit politics and more time on actually improving the language.

Also, I don't understand the point of Kotlin. Clojure, Groovy and Scala are all very distinctive from each other and have their own niche. Kotlin is just a subset of Scala. Same thing, but less features. I guess it's NIH principle applied to JetBrains.



The funniest part is how much this discussion sounds like the Java vs. Perl on web programming from decades ago.

In the end it is just politics. What will make a framework or language succeed is how influential its sponsors are (e.g.: IBM -> Fortran & Cobol, ATT -> C, MS -> Basic & C#, Sun -> Java, Google -> Python, MS & ATT -> C++, Apple -> ObjectiveC). The ideological arguments are just decoration, fancy wrapping and cosmetics to convince people to buy the thing.

If language "quality" alone was enough to win adepts, both Smalltalk and Lisp would be among the top 10 most used.

Kotlin might be better than Java, in the same sense a Dvorak keyboard might be better than a qwerty. But it doesn't seem better enough to force old Java dogs to care for new tricks.

Edit: typos.


But it doesn't seem better enough to force old Java dogs to care for new tricks.

Don't count on that.

I'm an old dog when it comes to Java. But I decided to give Kotlin a try on a little pet project of mine.

JetBrains are mad geniuses. In Intellij, with a hotkey you can convert Java to Kotlin. A couple of Alt-Enters and you have something almost idiomatic.

I converted the entire (small) project in an hour and then spent a bunch of time reworking parts to take advantage of Kotlin's functional features.

And I could convert incrementally and test each migration because the Java interop is absolutely seamless. They've completely eliminated the risk and friction of trying the language out.

I even found a bug along the way due to Kotlin's null checker.

It's brilliant!

JetBrains gets it. They produced a language that's new yet familiar (sorry Clojure), powerful yet still easy to understand (sorry Scala), and has essentially zero barrier to entry due to interop and tooling support.


> JetBrains are mad geniuses. In Intellij, with a hotkey you can convert Java to Kotlin. A couple of Alt-Enters and you have something almost idiomatic.

The same works for Scala.

> powerful yet still easy to understand (sorry Scala)

Kotlin is way less powerful than Scala. And if you dumb down Scala to Kotlin level by just not using the more advanced features (it is easy to turn them off globally), you're basically writing Kotlin. I can't see how Scala is less readable then - the differences are really cosmetic.


I find Scala suffers from similar problems you find in Haskell or C++: an overly complex type system, obsession with operator overloading, way too many ways to do things leading people to find a "manageable subset" they can deal with. Like Haskell (and its many extensions), it feels a little too much like a language that was designed by throwing nifty ideas at a wall without cutting out the stuff that didn't stick.

Add in the slow compiler, sbt (I don't need another build system, thanks), and IDE support that's only finally decent, and speaking for myself, it's not my thing.

Fortunately, it is the nature of the Java ecosystem that we can pick the language and tooling we prefer and we can all still get along! So while I'm a fan of Kotlin, hey, if Scala is your bag, enjoy!


Scala has no operator overloading. You cannot blame language on somebody picking bad method names. There are plenty of bad names in Java and Kotlin libraries as well.

> an overly complex type system

It is only as complex as it has to be to solve problems it was designed to solve. I take a more complex type system that make complex problems hard to solve rather than a simplistic type system that make complex problems impossible to solve.

> it feels a little too much like a language that was designed by throwing nifty ideas at a wall without cutting out the stuff that didn't stick

Name a few that could be removed without making the language significantly less powerful. Most people saying "Scala is complex" really want to say "Scala has many concepts I'm unfamiliar with". Java or C are also "too complex" for most VB programmers.

> Add in the slow compiler

It is not as bad as you may think, and IDE support is stellar, so I don't need to compile really that often. Many successful languages have much slower compile times: C++, Rust. Incremental compilation is fast enough. I get typically 1-5 seconds compile times.

> sbt (I don't need another build system, thanks)

SBT is not mandatory. Just a tool. Pick whatever you wish. Scala works perfectly fine with Gradle or Maven.


Kotlin is a smart subset of Scala.

Scala did a lot of things that pushed mainstream programming forward, but it's also crapped up with a lot of detritus, ideas that didn't work out, and ideas that were always obviously bad.


> Kotlin is a smart subset of Scala

Yes, it is only the subset you need, nothing else. That is why is here to stay and Scala not.

Making the things more complex doesn't mean making them better. Do one thing, and do it right. Don't do a lot of things half good.


Scala does all the features of Kotlin equally well, not half good.

Actually Kotlin inherited a few bad ideas from Scala as well - which Scala already dropped like procedure syntax.

And some features like null handling or coroutines in Kotlin are implemented as language features - special cases in the compiler, because the core of the language lacks abstraction mechanisms. This is making the language more complex than Scala.

Scala: minimal and powerful language core, the rest is in libraries.

Dotty: make this core even smaller

Kotlin: take a powerful language like Scala, remove almost all of the unnique abstraction features, leave only "better Java syntax" and then reimplement missing features by special cases directly in the language instead of libraries. Feels like VB of XXI century.


I have written Scala code and kotlin code, and it is much more legible the kotlin code. When I tried also there were problems calling Scala code from Java (I think there were problems with the type inference system that was giving me non-sense errors). Scala adds like 500kb to an Android app, kotlin only few kb. The compilation times are much faster with kotlin, the tooling support is also better. It is easier to become more productive with kotlin than with Scala.

> Scala already dropped like procedure syntax

Do you mean this?: https://groups.google.com/forum/#!topic/scala-internals/q1YX...

Kotlin does not do that.

> some features like null handling or coroutines in Kotlin are implemented as language features

null handling yes, and it is very well done. Coroutines so so, they added a couple of keywords to the language and most of the implementation is in the library. You can create your own coroutines: https://kotlinlang.org/docs/reference/coroutines.html

Go do coroutines quite good and they have also implemented in the language, why is it bad they use a couple of keywords for those special cases?


> Scala adds like 500kb to an Android app

This is a lie. Please stop spreading these lies about Scala requiring a huge runtime. Scala runtime adds about 30 kB, which is nothing in 2017.

> the tooling support is also better.

Both use the same IDE from Jetbrains and both are officially supported. Hard to tell which one is really better, but Kotlin support has more issues in its bug tracker, despite being less popular :P

> (nulls) it is very well done.

It is not. It makes the type system more complex, and you can't abstract over optionals and other collection types. You also can't make your own flavor of optional-kinds, like Either or Try that would behave similar to the builtin nullability feature.

The biggest problem with builtin features is that you can't make your own slightly different ones. You're at mercy of one company controlling the language. With a smaller language + libraries, you can always fork a library and do modifications.


I totally agree. My main point against Scala is the mass of features, it's like a modern C++. In the worst case you end up with a dev team in which everyone codes in his very own style.


> Nothing really changed, you could write Android apps on Kotlin before, as well as on any other JVM language. But now "Kotlin is the hero".

The announcement shows Google making a commitment to make Kotlin successful in Android, rather than leaving the effort all to the community and JetBrains.

> I suspect that Google's adoption of Kotlin is just politics: [...] Google could acknowledge Scala years ago, but didn't [...]

I think this post explains it best: https://medium.com/@ScalaWilliam/why-scala-didnt-miss-the-an... .

In regards with the Scala evolution, there's a lot of things to be excited about. In the near term, 2.13 should see various optimisation to core libraries and faster compilation.

> Also, I don't understand the point of Kotlin. [...] Kotlin is just a subset of Scala. [...]

Kotlin is a better Java, whereas Scala is much, much more.

Scala is still my go-to JVM languages, but one Kotlin use case for me is to write libraries that will be called from Java [1]. Its biggest advantage is that it's succinct, has useful functional features (e.g. Scala-like collections), while producing code signatures that's very close to Java.

Notes:

[1] - https://github.com/builtamont-oss/cassandra-migration


Also, I don't understand the point of Kotlin. Clojure, Groovy and Scala are all very distinctive from each other and have their own niche. Kotlin is just a subset of Scala.

Uh.

Yeah. Exactly.


I see Kotlin as a fixed Java, not a subset of Scala. While both may be true views, I think the "fixed Java" view explains the drama behind the announcement.

Kotlin is better at being Java than Java is. Scala is not.


Ever tried to code a robust Android app in Scala? It's a nightmare. Kotlin you just plugin and you can convert your source files very easily. I would agree syntax is not that much different but the compatibility is.


Scala has the same problem as java. Too many different opinions on how to do things. Too much cruft and ways to shoot yourself.

I see Kotlin as a clean-up job of a lot of syntax design flaws in java.




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

Search: