3 ms·
I think there is no point in trying to emulate different language semantics on top of JavaScript. asm.js is a weird hack that lives in a totally different worl
by Nitramp 11y ago
I think there is no point in trying to emulate different language semantics on top of JavaScript.
asm.js is a weird hack that lives in a totally different world than actual browser APIs (e.g. the DOM), and you have to emulate your entire runtime and environment to get anything useful, which means your binary is going to be huge (as in this example, but similar things apply).
Emulating better semantics than JS based on JS usually leaves you in this uncanny valley where you either trade off performance and size for nicer semantics (e.g. killing the null/undefined dichotomy, or 64 bit integer math), or you end up with odd semantics that don't quite fit the language you're compiling from, or a mix of both, which is a usability disaster.
So the only real chance to improve on the state of JS is being a syntactical shim on top of JS and help users with better syntax, static analysis, and compile time tooling. That'd be TypeScript.
- fragmede 11y ago> That'd be TypeScript. Or CoffeeScript. Or Dart. Or this. In fact, here's a whole big long list of other languages. Most of which don't use the asm.js "weird hack". https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS https://github.com/jashkenas/coffeescript/wiki/List-of-langu...
- alexweber 11y agoone weird hack to run assembler-like code in the browser! developers hate him!