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

Use enums more freely #1639

Closed
gbrail opened this issue Sep 21, 2024 · 7 comments
Closed

Use enums more freely #1639

gbrail opened this issue Sep 21, 2024 · 7 comments
Labels
enhancement good first issue Great place to start if you're looking to start an open source "resume" Potentially Breaking Change Issues that could break backwards compatibility

Comments

@gbrail
Copy link
Collaborator

gbrail commented Sep 21, 2024

We have a lot of places, especially in parser-related things, where we have a pattern of integer identifiers that have to remain unique, like this:

Now that people are adding lots of new language features (thanks!) this is becoming a maintenance nightmare, because all it takes is two or three people modifying the same list of integers to create a merge conflict.

Fortunately, since the 1990s Java has added proper enums.

It would be wonderful if someone could take on the task of replacing these enum-like structures in Rhino with proper Java enums.

@gbrail gbrail added the good first issue Great place to start if you're looking to start an open source "resume" label Sep 21, 2024
@p-bakker
Copy link
Collaborator

This would constitute a breaking change, for people that interact with the parser directly, no?

Do note that roughly, these are the current language features that Rhino doesn't yet support that involve new syntax:

And stuff in the TC39 proposals pipeline (stage 2.7 & 3):

All this to say: yes we had quite a few language features added recently with super being added for some additional operators, but likely going forward well have less conflicting PRs. Not saying we shouldn't do this, but given this resulting in a breaking change, I think we should consider not doing this before a V2.x.x

@p-bakker p-bakker added enhancement Breaking Change Potentially Breaking Change Issues that could break backwards compatibility and removed Breaking Change labels Sep 22, 2024
@andreabergia
Copy link
Contributor

IMHO the benefits would overweight the cost. If someone has opened PRs yes, it might take a bit of refactoring, but the maintenance of some of these existing patterns (for example, the Token, which I've had to touch for some recent PR) is a lot worse.

@rbri
Copy link
Collaborator

rbri commented Sep 23, 2024

fine for me, please do it

@gbrail
Copy link
Collaborator Author

gbrail commented Sep 23, 2024 via email

@rPraml
Copy link
Contributor

rPraml commented Sep 24, 2024

I've tried to do this, but I see serveral show stoppers:

Here is the start of the PR #1647 if really someone want to continue

@rbri
Copy link
Collaborator

rbri commented Sep 25, 2024

#1648 is merged, i think we can live with the current solution for a while

@p-bakker
Copy link
Collaborator

Closed by #1648

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Great place to start if you're looking to start an open source "resume" Potentially Breaking Change Issues that could break backwards compatibility
Projects
None yet
Development

No branches or pull requests

5 participants