Hacker News new | ask | show | jobs
by lmm 3387 days ago
If Kotlin wasn't just CoffeScript for Java but a whole new language then there would be no reason to use it instead of Scala. There's an excluded middle here: either it's a very-close-to-Java language (in which case probably not worth the cost of using) or it's a language that's significantly different from Java (in which case it has no interop/familiarity advantage over Scala and the two languages have to be compared on their merits - and I'd say Kotlin comes off pretty poorly in that).

> It's 100% compatible to Java so of course it's not a completely different language. Haskell is a different language. I like Haskell, but I'm glad that I don't have to convert all my old java code to it.

> I can open old java-projects and use Kotlin on a file-by-file basis without any problems.

Sure. I do exactly that in Scala too.

1 comments

One of the arguments against Scala is that its large and simply too feature rich. https://agilewombat.com/2016/02/01/scala-vs-kotlin/
The parts it does add are small and orthogonal. They can be combined to make surprising things, but that's the mark of a good language - it lets people write very complex libraries, but by combining simple features in ways that make sense.

Specifically, call by name is highlighted in the IDE these days (though I agree we would be better off without it), implicit parameters are really important and it's not hard to ensure consistency, for comprehension is the opposite of what that site is saying (dealing with multiple monads is a lot harder without it, and it's not like ignoring monads as Kotlin does makes the problems you need monads for go away), and the rule about operators is incredibly simple (your method name is just your method name, if you want to write a "" operator you call it "" rather than having to remember what the magic name for overloading that is).

Meanwhile your link ignores the many complex features in Kotlin e.g. delegation, platform types. Maybe they were added since it was written - Kotlin seems to add a lot of ad-hoc features very quickly.