3 ms·
What about features like harmony proxies? I'd like to see someone transpiling that to ES5 and getting code that isn't super-slow. Edit: Consider this dummy exa
by spion 13y ago
What about features like harmony proxies? I'd like to see someone transpiling that to ES5 and getting code that isn't super-slow.
Edit: Consider this dummy example:
f(a, b) { return a + b; }
With operator overloading, the compiler has to account for that, and must transpile to e.g.
function f(a, b) { return __invokePlus(a, b); }
Unless the programmer adds type hints
f(num a, num b) { return a + b; }
Edit: mraleph told me that I'm incorrect - apparently the transpiler does global type inference on the code and will only generate a function call if the type needs it (or if it can't figure out the type)
- munificent 13y ago> mraleph told me that I'm incorrect - apparently the transpiler does global type inference on the code and will only generate a function call if the type needs it (or if it can't figure out the type) Exactly right. We need to do that, or numeric code would be impossibly slow when compiled to JS.