News for hackers. Stuff that matters.
Re:Kotlin becomes second most popular language on the JVM by lmm on Thursday February 06, 2020 @10:08PM (#22262897)
> A big advantage of Kotlin over e.g. Scala and other JVM languages that are not Java is that it is designed from the ground up make the transition as seamless as possible. Scala is so far removed from Java that it's generally a completely separate ecosystem with its own libraries, tools, frameworks, idioms, etc. Yes you can use Java stuff but it's generally frowned upon by Scala people.

> This is not the case with Kotlin at all. The Android ecosystem started transitioning to Kotlin long before Google recommended that and before Kotlin 1.0 because the pain of having to deal with Java 6/7 just made that development so much better. A few years ago they started endorsing and recommending it and at this point they are clearly deprecating a lot of stuff that they did for Java that can be done better with Kotlin e.g. embracing co-routines over rxjava, adding extension functions and kotlin dsls and designing new features that really only make sense if you use Kotlin. On Android, if you are doing Java, you are working on a legacy code base.

There's a contradiction between your paragraphs; my experience is that as Kotlin projects mature, they also reach a point where developers frown on Java idioms. I mean fundamentally either the language is different from Java or it isn't; if it is, the transition isn't going to be seamless, and if it isn't, then why use it? The Kotlin community may have been better at being supportive, but the practical experience of making the transition is exactly the same (e.g. I used Spring for my early Scala projects, and found that to be a very nice way of working).

Re:Kotlin becomes second most popular language on the JVM by thu2111 on Friday February 07, 2020 @03:25AM (#22264138)
Which Java idioms do Kotlin programmers frown on? (I am one)

The only ones I can think of are where the language provides a feature that automates some Java boilerplate, so it wouldn't make sense to write things out by hand anymore. Otherwise they're semantically identical languages so the gap isn't big.

Re:Kotlin becomes second most popular language on the JVM by lmm on Friday February 07, 2020 @07:11PM (#22272588)
Things like builders no longer make sense if you have named arguments. Transforming or filtering a collection is more idiomatic than mutating it in-place. Factories don't make sense when first-class functions do the job better. Basically everything that's frowned on in Scala is also frowned on in Kotlin, in my experience.
Re:Kotlin becomes second most popular language on the JVM by thu2111 on Saturday February 08, 2020 @09:31AM (#22275870)
Good points. It'd be great if the kotlin compiler could produce builders or "withers" automatically.
Re:Kotlin becomes second most popular language on the JVM by lmm on Saturday February 08, 2020 @07:35PM (#22279630)
Would you really want them? If you write code in that style then you're giving up a lot of the advantages of Kotlin.

IMO there's a contradiction at the heart of Kotlin's positioning. As the quote goes, a language that doesn't affect the way you think about programming, is not worth knowing. If programming Kotlin is just like programming Java, why not just keep programming Java? If you want to switch to Kotlin because it's going to unlock a better way of programming, then that's going to have to mean changing how you program. It may work as a trick to get users on board at the start, but ultimately the language will have to find its own idioms and patterns, or else go the way of CoffeeScript.

Re:Kotlin becomes second most popular language on the JVM by thu2111 on Monday February 10, 2020 @08:59AM (#22289115)
I'm talking about what it compiles down to. Kotlin routinely generates bytecode that uses Java idioms either for its own ABI or in addition to it. So yeah, if some builder classes were produced behind the scenes for an immutable data class, why not, that'd be cool. You could always disable that feature with a flag if for some reason the bytecode size was an issue.