News for hackers. Stuff that matters.
Re:ChowJS: An AOT JavaScript engine for game consoles by munificent on Thursday September 16, 2021 @07:22PM (#28559075)
> And it’s increasingly common that the code is written in TypeScript, which has tons of static analysis potential.

It's probably worth noting that TypeScript's type system is deliberately unsound in a couple of corners that make it hard for a compiler to rely on the type system for optimization purposes.

Re:ChowJS: An AOT JavaScript engine for game consoles by eyelidlessness on Friday September 17, 2021 @01:09AM (#28561446)
I’m very aware of that, both from building libraries around the type system and watching the type system itself evolve over the last few years. While unsoundness is still a principle of the project, quite a lot of it has been addressed since 3.6 or so.

But an optimizing AOT compiler doesn’t need TS to be sound any more than a JS JIT does. It just needs to optimize the paths it has confidence in.

To the extent TS code hasn’t escaped type safety, a compiler can be aggressively strict and optimize wherever the types are unambiguous. And it can fall back to the dynamic compilation it already has otherwise.