mozilla / rhino

Rhino is an open-source implementation of JavaScript written entirely in Java
https://rhino.github.io
Other
4.12k stars 848 forks source link

ES2015 Classes and inheritance #835

Open heywiki opened 3 years ago

heywiki commented 3 years ago

Are there any plans in the near future to implement classes and inheritance in Rhino? And other OO related features described here: https://medium.com/ecmascript-2015/es6-classes-and-inheritance-607804080906

gbrail commented 3 years ago

Class support would be great. It's mainly a case of digging into the parser and syntax tree and making all that work. It's not a easy job though, which is why I don't think anyone has tackled it yet. It's a great project for an ambitous volunteer though.

p-bakker commented 2 years ago

Note that while this case is in milestore ES2015, to date there's a pletora of additional proposals that have made it into the ECMAScript standard that we should also consider when picking case up.

There are currently no stand-alone issues registered for Rhino for all these followup proposals, as they all depend on the initial Class implementation.

Browse https://github.com/tc39/proposals/blob/master/finished-proposals.md for an idea of the followup proposals, like https://github.com/tc39/proposal-class-static-block or https://github.com/tc39/proposal-private-fields-in-in, just to name a few

p-bakker commented 2 years ago

something to keep in the back of our minds when implementing Classes: ability to extend Java classes and syntax suger

Note that at the time of writting, GraalJS doesn't support extending Java classes: https://github.com/oracle/graaljs/issues/32#issuecomment-409977665

p-bakker commented 2 years ago

Some details on the @@Species/Symbols.species behavior when it comes to subclassing built-ins: https://github.com/tc39/proposal-rm-builtin-subclassing