News for hackers. Stuff that matters.
Re:From zero to 10M lines of Kotlin by purplerabbit on Tuesday October 25, 2022 @11:22AM (#33331826)
Have you tried TypeScript? My impression having used it in both JetBrains and VSCode is that it achieves basically what you're describing.

I similarly get irritated using anything else now.

Re:From zero to 10M lines of Kotlin by randy909 on Tuesday October 25, 2022 @11:33AM (#33331977)
I've used both and Kotlin was a better overall experience for me. TypeScript has weird typing problems far more often due to the underlying runtime being dynamically typed.
Re:From zero to 10M lines of Kotlin by purplerabbit on Tuesday October 25, 2022 @12:28PM (#33332788)
What problems in particular have you run into? Genuinely curious.
Re:From zero to 10M lines of Kotlin by lf-non on Tuesday October 25, 2022 @01:27PM (#33333593)
While I like TS and it is my primary language currently, having worked with Kotlin in past I find the dev experience with kotlin to much better, esp. if you steer clear of libraries that lean heavily on bytecode weaving, compiler hooks etc.

Kotlin's type system is nominative and so while it is not as flexible as typescript (no intersection types, conditional types etc.) it also means that you don't run into those multi-page long type errors which need 5 mins of debugging to figure that some deeply nested object is null where undefined is expected.

It is particularly funny when the language server truncates the errors and it becomes impossible to infer the actual issue from the message. Every now and then I find myself extracting things out of objects and adding type annotations to simplify the errors. It is doable, but never needed in Kotlin.

Re:From zero to 10M lines of Kotlin by bmc7505 on Tuesday October 25, 2022 @11:48AM (#33332183)
Types in TS are Turing Complete [1], so any static analysis you build ontop of that language is bound to be unsound or undecidable. You could argue this rarely occurs in practice, but I would prefer a type system that is incomplete but sound and decidable. Incidentally, this issue also affects Java, which is both unsound [2] and undecidable [3]. Kotlin does have a fairly complicated subtyping relation [4], which has caused similar issues in languages like Scala [5], however whether the same issue affects languages based on mixed use-site and declaration-site variance like Kotlin is still an open question that requires further investigation.

[1]: https://github.com/microsoft/TypeScript/issues/14833

[2]: https://io.livecode.ch/learn/namin/unsound

[3]: https://arxiv.org/abs/1605.05274

[4]: https://kotlinlang.org/spec/type-system.html#subtyping

[5]: https://arxiv.org/abs/1908.05294

Re:From zero to 10M lines of Kotlin by bottlepalm on Tuesday October 25, 2022 @10:35PM (#33339093)
So your reason to avoid TypeScript is some very rarely encountered corner case? Talk about perfect being the enemy of the good.

No language is perfect. Your comment is absurd, and the citations are pedantic.

Re:From zero to 10M lines of Kotlin by seanmcdirmid on Tuesday October 25, 2022 @10:39PM (#33339119)
TypeScript works well because they don’t worry about soundness and completeness. The type system isn’t trying to be perfect, just useful. This scares PL theorists, but I think it has been a very profitable corner of the design space to explore.