Welcoming ECMAScript 2015 in 2022!

50 views
Skip to first unread message

Sam Clegg

unread,
Dec 17, 2021, 7:56:01 PM12/17/21
to emscripte...@googlegroups.com
I'm hoping to land a change soon that will pave the way for allowing certain ES6 constructs in emscripten core libraries: https://github.com/emscripten-core/emscripten/pull/15763.

The upshot for most users will be smaller, more idiomatic JS output.   For those users that are targeting older browsers that don't have full ES6 support the default solution is to use closure compiler to (in WHITESPACE_ONLY mode) to transpile the output.   This transpilation will kick in automatically if you specify a `MIN_XX_VERSION` that doesn't support the ES6 features we are using.

The downside here is that there will be an extra step in the linking process for some users.   The upside is more easy-to-maintain and smaller JS code size. 

cheers,
sam

Sam Clegg

unread,
Dec 23, 2021, 5:46:30 AM12/23/21
to emscripte...@googlegroups.com
Emscripten 3.1.0 has now been released with a minimal amount of internal ES6 usage (https://github.com/emscripten-core/emscripten/pull/15765).  Assuming we don't hear of any issues in the next couple of weeks we will start moving ahead with more usage in the new year.

cheers,
sam

Sergey Rubanov

unread,
Dec 24, 2021, 6:00:50 AM12/24/21
to emscripte...@googlegroups.com
Hi Sam!

This is great news! I would like to help with the ES2015 transition. Do you have a roadmap or a list of of changes to be done? Which tests would be useful to run on es2015 changes?

Cheers
Sergey

-- 
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va28skh-3PZ5_f5k4KDe75sJUN-2kMDj%2B37BE7wFX-Hs7vA%40mail.gmail.com.

Sam Clegg

unread,
Dec 29, 2021, 7:00:25 AM12/29/21
to emscripte...@googlegroups.com
Hey Sergey,

I generally run all the non-slow tests in the `wasm2` and `other` test suites. (for example `./tests/runner wasm2 --skip-slow`).

And then in particular I rebaseline all the codesize tests to see the effect on code size.  I do this with `./tests/runner other.*code_size* other.*metadce*  --rebaseline`.

In terms of ES2015 features I have a couple of pending changes:


I was thinking of waiting until mid january to land these to give folks a chance to report any issues with ES6 usage in general.

Aside from that, the big change that I've not started on is the `var` to `const/let` conversion.   You are welcome to take a look at that if you like.   I would suggest we first do a global `var` -> `let` conversion before thinking about whether we want to introduce `const` since it has a potential code size cost. 

What other ES2015 features do you think would be valuable to start using?

cheers,
sam

Reply all
Reply to author
Forward
0 new messages