Graaljs: Support TC39 Class Fields

Created on 1 Oct 2019  路  3Comments  路  Source: oracle/graaljs

Per https://github.com/tc39/proposal-class-fields major JS implementations are starting to allow "field" declarations in classes. Since it works in Node and Chrome on default settings, developers assume it is "safe" to use, but unfortunately Graal does not seem to understand the syntax.

enhancement

Most helpful comment

Hi @stevenschlansker

thanks for your question. We strive to be compatible with the latest spec (i.e. ECMAScript 2019 currently). The proposal you quote is at stage 3 currently, so it might land in ECMAScript 2020 (it is not scheduled to be discussed at the current TC39 meeting, though).

In general, we implement everything that is stage 4 already (and thus scheduled for the next official release), but also relevant stage 3 proposals. We would only provide it in ES2020 mode though, so you would need to provide an extra flag at the moment (--js.ecmascript-version=2020). @woess what is your take on that, should we implement that?

Thanks,
Christian

All 3 comments

Hi @stevenschlansker

thanks for your question. We strive to be compatible with the latest spec (i.e. ECMAScript 2019 currently). The proposal you quote is at stage 3 currently, so it might land in ECMAScript 2020 (it is not scheduled to be discussed at the current TC39 meeting, though).

In general, we implement everything that is stage 4 already (and thus scheduled for the next official release), but also relevant stage 3 proposals. We would only provide it in ES2020 mode though, so you would need to provide an extra flag at the moment (--js.ecmascript-version=2020). @woess what is your take on that, should we implement that?

Thanks,
Christian

We've implemented the above-mentioned proposal. It's been merged to master and will be part of the GraalVM v20.1.0 release. Currently, it has to be enabled using the option js.class-fields but is available by default in our Node.js implementation.

Thanks all! Our frontend devs will be ecstatic :)

Was this page helpful?
0 / 5 - 0 ratings