mozilla / rhino

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

ES2025 New Set methods #1542

Open p-bakker opened 4 months ago

p-bakker commented 4 months ago

https://github.com/tc39/proposal-set-methods

camnwalter commented 3 months ago

Just an FYI for anyone else, a lot of the test262 tests for these methods fail because they use spread syntax and/or classes

p-bakker commented 3 months ago

Any idea if those test really depend on spread and classes? If not, we could consider creating a PR with the test262 project with changes that eliminate the dependency on spread and classes.

Recently did the same for some other code in test262 that used syntax Rhino couldn't handle and the test262 is quite receptive to such changes

camnwalter commented 3 months ago

I don't think the spread is necessary. They are only used to compare the values in the set with the expected values in an array, at the very end. They could be using Array.from instead.

However, the classes are probably needed just for completeness.

p-bakker commented 3 months ago

Just looked at the tests for the 'difference' method and the relative tiny subset of tests that use classes explicitly seem to test the method icw classes, so nothing that we can do about those (unless someone feels like taking a stab at implementing classes 🤪)

The use of the spread operator can be replaced with .apply in the tests, making them compatible with Rhino

Or we try to implement the spread syntax in Rhino 🙂