Re:Why Tcl?
by a_wild_dandan on Tuesday June 20, 2023 @05:52PM
(#36411206)
You don't need a compiler. The vanilla `node` binary works fine with a few trivial syntactic changes.
It sucks that your compiler's slow! Check out `swc` if you prefer speedy compilation.
swc doesn't do type checking, so while useful in some cases it's not really a replacement for tsc.
Does node do static type checking?
Re:Why Tcl?
by a_wild_dandan on Wednesday June 21, 2023 @11:01AM
(#36419362)
Nope! `node` is just a binary that executes JS code (e.g. the above code, mod a few syntax choice tweaks). Since JS has no static types, `node` has no types to check.
Other languages can be compiled (perhaps "transpiled") to JS, some of which have static type mechanisms. One of those other languages, TypeScript, has static types. There are tools to compile TypeScript into JS: `swc`, `tsc`, etc. There are also tools to statically type check TypeScript (`deno`, `tsc`, etc).
Personally, I use `swc` for speedy TS compilation. I use my IDE's `tsc` language server for the separate job of highlighting type issues. But everyone has their preferred workflow!
But you need to convert the TS to JS, and the TS compiler takes like 3 seconds to start on my laptop (orders of magnitude slower than any other compiler I know, although you can speed it up a bit if you disable type checking, but that, well, removes type checking).