News for hackers. Stuff that matters.
Re:The Hitchhiker's Guide to Kotlin by nassimsoftware on Tuesday September 21, 2021 @06:01PM (#28610563)
Kotlin is a really nice language. I wish it was used more especially that now it isn't just limited to the Android and Java ecosystems.

Kotlin can now compile to native binaries : https://kotlinlang.org/docs/native-overview.html#sharing-cod...

Kotlin can now compile to Javascript : https://kotlinlang.org/docs/js-overview.html Edit : You can even use React with Kotlin : https://kotlinlang.org/docs/js-get-started.html

Kotlin can now be used for datascience as well (You can run kotlin code in a jupyter notebook) : https://kotlinlang.org/docs/data-science-overview.html#libra...

Re:The Hitchhiker's Guide to Kotlin by pjmlp on Tuesday September 21, 2021 @06:15PM (#28610682)
Kotlin/Native is hardly a stable target, given that they botched the implementation by going with an incompatible memory model as Java, and have spent the last year fixing it by rebooting it with a proper GC implementation.

Hardly any better than just using GraalVM or any other JVM AOT compiler, some of which go back to early 2000's even if only available in commercial JDKs.

The JavaScript compilation target still needs to do some catching up with TypeScript.

Re:The Hitchhiker's Guide to Kotlin by erpellan on Tuesday September 21, 2021 @06:22PM (#28610763)
I feel the non-JVM targets are a real distraction from what is a lovely language. I’d rather they focussed more on fixing the issues with kotlin in IntelliJ - you’d think controlling both the language and the IDE would result in a less buggy experience than the current situation.
Re:The Hitchhiker's Guide to Kotlin by pjmlp on Tuesday September 21, 2021 @06:24PM (#28610780)
I agree, to me it feels just like JetBrains turned Borland just before the Inprise Corporation makeover.
Re:The Hitchhiker's Guide to Kotlin by zorr on Thursday September 23, 2021 @11:15AM (#28630377)
Could you elaborate on specific issues you have with Kotlin/IntelliJ? I use both as my daily work environment and I barely have issues.
Re:The Hitchhiker's Guide to Kotlin by erpellan on Friday September 24, 2021 @07:14PM (#28648844)
It frequently loses track of libraries, claiming large chunks of the codebase won’t compile until caches are cleared and it is restarted.

It gets stuck indexing forever, losing all code completion and navigation abilities until it’s restarted.

Git integration sometimes stops working. It will list the files to be committed but does nothing when you click commit, until it’s restarted.

Exiting presentation mode leaves the font set to a huge size (until it’s restarted).

Re:The Hitchhiker's Guide to Kotlin by lokedhs on Thursday September 23, 2021 @09:24AM (#28628755)
My personal open source evening hacking project for the last year or two has been a Kotlin multiplatform project. It's language interpreter that runs on the JVM, Native and Javascript.

Since the project is an interpreter, it's easy to do performance testing between the different platforms. I just write some program in my language, and run it on each implementation.

The results are interesting. The JVM target is consistently 20 times faster than native. Now some of this is because memory allocations are so fast in the JVM, so if your programs does less memory allocations the difference won't be that great. However, if you compile Kotlin to native code, one has to accept that it's much slower.

Another problem with native compilation is that it's quite slow. I wouldn't want to do all my development using native, but rather develop using the JVM and then compile to native for the use cases that need it.

The only time I think that native would make sense is if you absolutely cannot run the JVM for some reason. One such reason would be for embedded (which would have to be ARM, since that's the only embedded architecture that's supported).

Re:The Hitchhiker's Guide to Kotlin by nassimsoftware on Tuesday September 21, 2021 @06:17PM (#28610707)
What catching up is required compared to TypeScript? Could you go in bit more details on that, I'm curious.
Re:The Hitchhiker's Guide to Kotlin by pjmlp on Tuesday September 21, 2021 @06:19PM (#28610731)
Ecosystem, tooling, libraries.
Re:The Hitchhiker's Guide to Kotlin by smallerfish on Tuesday September 21, 2021 @06:53PM (#28611038)
It's actually very good - debugging from the IDE now even works. I'd recommend building around KVision rather than raw KotlinJs (https://kvision.gitbook.io/kvision-guide/).

The main thing that can be annoying is figuring out module exports from a js library that you want to use (which is probably easy enough if you have a modern javascript background). I haven't found a library that's stumped me yet, but some are more annoying than others. Jetbrains have a tool called Dukat which will supposedly one day automate this, but for now it's not there.

Distribution size can be an issue, but it's not terrible. My current (moderately complex) app is floating at around 2MB. I haven't tried splitting it up, though that is possible.

Re:The Hitchhiker's Guide to Kotlin by pjmlp on Wednesday September 22, 2021 @07:20AM (#28615106)
Except the platform is JavaScript, and TypeScript is basically Web IDL aware compiler on steroids, no need to use anything that adds even more layers.
Re:The Hitchhiker's Guide to Kotlin by smallerfish on Wednesday September 22, 2021 @07:39AM (#28615230)
That depends. If the rest of your application is in Kotlin, you're reducing cognitive overhead. Same language, same compile, same distribution. You can share view models between frontend and backend. It's much closer to what GWT promised to be than GWT ever was.
Re:The Hitchhiker's Guide to Kotlin by pjmlp on Wednesday September 22, 2021 @10:28AM (#28616679)
Guest languages are always an impedance mismatch with the underlying platform.

I don't buy into sharing source files instead of clean separation via Web APIs, the additional tooling complexity isn't worth the pain.

I did vote against stuff like GWT already several times, and every time it has been proven to have been the right decision, when things went hot.

Re:The Hitchhiker's Guide to Kotlin by smallerfish on Wednesday September 22, 2021 @02:03PM (#28619615)
> I don't buy into sharing source files instead of clean separation via Web APIs, the additional tooling complexity isn't worth the pain.

Fair enough, that's a different argument from the one you posed upthread though. The ecosystem and tooling are very much there.

Happy to disagree on architectural merit of the approach. Personally I'm done with javascript/typescript for any future products/teams I build, and am glad to have a viable solution.

Re:The Hitchhiker's Guide to Kotlin by ParanoidShroom on Tuesday September 21, 2021 @06:48PM (#28610988)
I do kotlin daily, almost exclusively including side projects.

Kotlin native has been rocky personally, I'll check back in a year.

Kotlin on Android is a must compared to Java, else you're a fool. Haven't seen any exceptions in the industry.

Kotless is okay, works, but early days.

I've seen decent backends on quarkus and kotlin.

It's a fun language, the couroutine development is pretty nice. Flow is a lot easier than Rxjava.

Re:The Hitchhiker's Guide to Kotlin by bestinterest on Wednesday September 22, 2021 @05:28AM (#28614495)
Coroutine stuff worries me in Kotlin, what happens the minute Project Loom comes out? Even more fracturing of styles?
Re:The Hitchhiker's Guide to Kotlin by vips7L on Tuesday September 21, 2021 @06:59PM (#28611085)
Does kotlin native have a std lib yet? Last I checked you couldn’t even read a file.
Re:The Hitchhiker's Guide to Kotlin by BoxOfRain on Wednesday September 22, 2021 @10:07AM (#28616453)
I absolutely love Kotlin for backend web dev, I started using it as "Java but without the things in Java that piss me off" but the more I used its non-Java features the more I grew to love it. Sadly I've moved jobs so I'm not using it professionally any more but it powers my side project so I'm keeping my skills fresh.

I'd recommend it to anyone where they'd traditionally use Java or another similar language.