• Potentially the Web IDE could add polyfills, yes. There may even be some project out there that includes a bunch of polyfills? I know MDN often lists polyfills for 'new' features.

    ES6 has been around since 2015 or so and is a well-defined target?

    That's true, but my point was more a general one since initially Espruino didn't support ES5 and I worked hard to get most of that implemented. I could spend the next year making sure all of ES6 got implemented and there'd just be another question identical to yours saying: "ES7 has been around since 2016 or so and is a well-defined target?"

    even more so if the current standard library is shrunk by shifting less common functions to compile-time includes

    Yes, on very constrained targets this would make a lot of sense. But moving compiled C functions to JS does hurt performance significantly.


    You might not like it, but this is the obvious method to ensure that all of the newest language features (not just ES6) can get implemented.

    Language features

    I think where it makes sense we can definitely add these features, assuming there is time. Spread as per https://developer.mozilla.org/en-US/docs­/Web/JavaScript/Reference/Operators/Spre­ad_syntax actually looks doable in a reasonably easy way.

    The syntax in declarations like var logger = function(...params) { console.log.apply(null, params); } is more problematic though, and realistically to do it nicely (as well as default arguments) we need to change the way that function arguments are stored. It's something I would like to do, but it's quite a big change - I just wrote this up at https://github.com/espruino/Espruino/iss­ues/2266

    However, it's worth noting that some features (like async) just aren't compatible with the way Espruino works and implementing them properly would be a total nightmare. The JS architects assume the engine is build in a specific way (parsed into a parse tree, then bytecode/jit) and so they sometimes come up with syntax (like arrow functions - which I did manage to implement) that end up being very problematic to implement.


Avatar for Gordon @Gordon started