4 ms·
> I have a strange take - I think Typescript types are better most other languages, including Java, C++ and Go. It's strange since TypeScript is adding types to
by throw_m239339 4y ago
> I have a strange take - I think Typescript types are better most other languages, including Java, C++ and Go. It's strange since TypeScript is adding types to a weakly typed language.
Typescript types don't exist at run time, at all. So it's easy to be better when your language is merely about static analysis as it will not enforce any sort of type system during runtime. Java, Go or C++ have different constraints.
- dimitropoulos 4y agothat's a false equivocation in the sense that you just moved the goalposts by defining what "runtime" means. There are no types whatsoever as far as processors are concerned. No types in assembly Not for Go or Java, not for C, and not for Rust. All you gotta do is keep compiling.
- throw_m239339 4y ago> that's a false equivocation in the sense that you just moved the goalposts by defining what "runtime" means. I disagree, Javascript does have types and runtime type errors, just not all the ones Typescript compiler has, it makes Typescript extremely leaky as a Javascript abstraction. Typescript compiler cannot represent every single Javascript type combination either, it will would have to be a Javascript interpreter at first place.
- yencabulator 4y agoRuntimes exist above processors, you know. Here's types existing at runtime: https://go.dev/play/p/rc--yVzJ9bt https://go.dev/play/p/rc--yVzJ9bt
- kaba0 4y agoTo be honest, that’s the “default” way of type systems - without runtime reflection capabilities type erasure is just a normal phase of an AOT compiler, why would you store types?