News for hackers. Stuff that matters.
Re:Porting 30K lines of code from Flow to TypeScript by nerdponx on Monday January 14, 2019 @05:40PM (#18907231)
I've heard it said that Javascript and C are both good languages to compile to -- the language itself is very "fast" in basic operations (V8 is hyper-optimized, C is relatively close to the metal), but an ugly language with lots of gotchas and warts that make it hard for a human to use effectively, but which don't pose a problem for a well-designed compiler.
Re:Porting 30K lines of code from Flow to TypeScript by kccqzy on Monday January 14, 2019 @06:07PM (#18907435)
No lol. Javascript is not a good language to compile to. People compile to JavaScript only because it's the only language to run in browsers.

Most compilers, after type checking and semantic analyses, basically generate a control flow graph with basic blocks. Javascript doesn't have goto so it doesn't allow you to express those low-level things natively, which is why emscripten has to include a relooper component to turn them back into loops and conditionals.

If you want a good language to compile to, look at LLVM. It's a language designed to be compiled to, and it's mind-blowingly easy to compile to than either C or JavaScript.

Re:Porting 30K lines of code from Flow to TypeScript by brett40324 on Monday January 14, 2019 @06:30PM (#18907575)
It's maybe worth noting here that compiling to C and transpiling to JS are two entirely different paradigms of linking and building a software release.