2 ms·
I'm not entirely sure that that has been shown. By far and away the most popular compile-to-JS language is JavaScript itself, via tools like Babel. After that,
by MrJohz 5y ago
I'm not entirely sure that that has been shown.
By far and away the most popular compile-to-JS language is JavaScript itself, via tools like Babel. After that, you've got Typescript, which is still basically just JavaScript with some type annotations stuck to it. It's only after that that you start getting to languages like Cjs and Elm, which have more varied semantics and treat JavaScript more like a true compile target.
My reading of that would actually be the opposite: JavaScript is a pretty poor language to target, and, for all its flaws, it's easier to stick to languages that mostly have JavaScript-like semantics and syntax than opt for a different (and potentially better) language, but have to deal with the more complex debugging processes.
I think this will be different for Wasm, which has been explicitly designed as a compilation target, but that's still getting off the ground in terms of being suitable for general usage.
- fulafel 5y agoThe languages I listed don't really suffer from JS impedance mismatch or other major practical problems. The interop of course is still a hump from a programmer POV, a FFI to another language is always a portal to another culture.. But even there the shared object system and GC makes it much better than interop between native code languages. WebAssembly suitability for general HLLs is possible in the far future but there don't seem to be many eager consumers. People prefer JS interop, browser API access, and builtin high performance GC and a JIT of JS that can efficiently handle dynamic constructs with advanced compiler magic. Reimplementing those in your wasm targeting compiler would be a huge effort and complexity cost, and added bloat to compiled programs, even if wasm supported it.