Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES2015 Classes and inheritance #835

Open
heywiki opened this issue Feb 6, 2021 · 6 comments
Open

ES2015 Classes and inheritance #835

heywiki opened this issue Feb 6, 2021 · 6 comments
Labels
Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec feature Issues considered a new feature
Milestone

Comments

@heywiki
Copy link

heywiki commented Feb 6, 2021

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
Copy link
Collaborator

gbrail commented Apr 15, 2021

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 p-bakker added this to the ES2015 milestone Jun 29, 2021
@p-bakker p-bakker changed the title ES6 Classes and inheritance ES2015 Classes and inheritance Jun 29, 2021
@p-bakker
Copy link
Collaborator

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 p-bakker added the feature Issues considered a new feature label Oct 14, 2021
@p-bakker
Copy link
Collaborator

p-bakker commented Oct 15, 2021

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: oracle/graaljs#32 (comment)

@p-bakker
Copy link
Collaborator

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

@p-bakker p-bakker added the Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec label Jul 30, 2024
@gbrail
Copy link
Collaborator

gbrail commented Oct 25, 2024

This is a big hole in our language support today, IMO. I have struggled off and on to start on this but haven't found the time to really dig in.

Since there are a few of you working on the project now who have been able to really dig in to the parser and IR in detail, perhaps someone could take a crack at this...

I started experimenting with doing this solely as a "transformer" in the parse / compile pipeline, but I found that it wasn't all that helpful really, and I think that we're likely to require at least some new runtime support if we want to get everything right.

@andreabergia
Copy link
Contributor

As a first step, me and @0xe are working on implementing super outside of classes (it relies on prototype).
We expect it's gonna take at least a couple more weeks, but we're making good progress. The temporary branch is here, if you're interested, but the commit history (and the code) are a bit of a mess right now, which is we're not even opening a draft PR yet 🙂 https://github.com/andreabergia/rhino/tree/super-objects-no-class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec feature Issues considered a new feature
Projects
None yet
Development

No branches or pull requests

4 participants