TypeScript is surprisingly ok for compilers
matklad.github.io
TypeScript is surprisingly ok for compilers
1–10 of 245 posts
Re: TypeScript is surprisingly ok for compilers
#2Re: TypeScript is surprisingly ok for compilers
#3Is that really suprising? Typescript is yet another language that has, kicking and screaming, picked up most of the ML featureset. I'd expect it to be, well, fine; the lack of real pattern matching is a pain, so it's going to be inferior to OCaml, but fine, no different from using C# or Swift or Dart or Kotlin or something of that ilk.
Re: TypeScript is surprisingly ok for compilers
#4Re: TypeScript is surprisingly ok for compilers
#5Re: TypeScript is surprisingly ok for compilers
#6Is that really suprising? Typescript is yet another language that has, kicking and screaming, picked up most of the ML featureset. I'd expect it to be, well, fine; the lack of real pattern matching is a pain, so it's going to be inferior to OCaml, but fine, no different from using C# or Swift or Dart or Kotlin or something of that ilk.
Re: TypeScript is surprisingly ok for compilers
#7TS's type system is fun but a part of me always wonders how much faster TS's compiler would be if it was written in a compiled language (assuming "good implementation", which is a big assumption!)
Re: TypeScript is surprisingly ok for compilers
#8Re: TypeScript is surprisingly ok for compilers
#9it isn't, i have codebase in golang that is much larger than typescript and it is pleasant to work with lsp and compiles smoothly. With typescript i have to turn off lsp and even after that it takes long time too compile. There is a reason why people are writing typescript compiler in rust.
But still, I think I'd rather use Rust. I'm pretty sure the code would be nicer (e.g. no need for the explicit tag field or for the visitor hack).
Re: TypeScript is surprisingly ok for compilers
#10Is that really suprising? Typescript is yet another language that has, kicking and screaming, picked up most of the ML featureset. I'd expect it to be, well, fine; the lack of real pattern matching is a pain, so it's going to be inferior to OCaml, but fine, no different from using C# or Swift or Dart or Kotlin or something of that ilk.
It really hasn't. In this very post he had to use a visitor to work around the fact that switch isn't an expression.
JavaScript's support for iterators is also weirdly shit. It has `.map()` but that only works on arrays. You can't map an iterator!