3 ms·
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 irri
by purplerabbit 4y ago
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.
- randy909 4y agoI'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.
- purplerabbit 4y agoWhat problems in particular have you run into? Genuinely curious.
- lf-non 4y agoWhile 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.
- bmc7505 4y agoTypes 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 and requires further investigation. [1]: https://github.com/microsoft/TypeScript/issues/14833 https://github.com/microsoft/TypeScript/issues/14833 [2]: https://io.livecode.ch/learn/namin/unsound https://io.livecode.ch/learn/namin/unsound [3]: https://arxiv.org/abs/1605.05274 https://arxiv.org/abs/1605.05274 [4]: https://kotlinlang.org/spec/type-system.html#subtyping https://kotlinlang.org/spec/type-system.html#subtyping [5]: https://arxiv.org/abs/1908.05294 https://arxiv.org/abs/1908.05294
- bottlepalm 4y agoSo 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.
- seanmcdirmid 4y agoTypeScript 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. Variance rarely comes up in Kotlin because they don’t push immutability as much as Scala did. It’s like, there as an option but I’ve used it a total of two times in the last two years of full time Kotlin programming. Compared to typescript, Kotlin is fairly boring, but it is tooled well and is a vast improvement over Java.