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

Change default version to VERSION_ES6 #1755

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

gbrail
Copy link
Collaborator

@gbrail gbrail commented Dec 13, 2024

This changes the version set when a Context object is created to VERSION_ES6 by default.

It also adds language to the JavaDoc to indicate that:

  • We will not be adding additional versions after VERSION_ES6, but instead will introduce new features in new versions of Rhino, like other JavaScript engines.
  • Code that uses Rhino should plan on migrating to VERSION_ES6.
  • Projects that use Rhino should, if possible, stop relying on older language versions, as these typically are features that are incompatible with modern JavaScript.

(Simply changing VERSION_DEFAULT is not sufficient -- VERSION_DEFAULT unfortunately drives a number of odd behaviors that many tests and probably many programs depend on.)

A few other notes:

First, not setting the language level and assuming that Rhino is very very out of date is a common problem with new users -- I hope that this will help in that regard.

Second, a number of tests thought that they were setting the language level but they weren't because they re-used a class that created it's own Context, so that's fixed now!

This changes the version set when a Context object is created to
VERSION_ES6 by default.

It also adds language to the JavaDoc to indicate that:

* We will not be adding additional versions after VERSION_ES6, but
  instead will introduce new features in new versions of Rhino, like
  other JavaScript engines.
* Code that uses Rhino should plan on migrating to VERSION_ES6.
* Projects that use Rhino should, if possible, stop relying on older
  language versions, as these typically are features that are
  incompatible with modern JavaScript.

(Simply changing VERSION_DEFAULT is not sufficient -- VERSION_DEFAULT
unfortunately drives a number of odd behaviors that many tests and
probably many programs depend on.)
@p-bakker
Copy link
Collaborator

The name 'VERSION_ES6' doesn't really cover what it does anymore, as it basically means: 'the latest version of EcmaScript, as far as Rhino supports it'

Maybe create a new, final language version called VERSION_ECMASCRIPT or just ECMASCRIPT or if not a new language version, then just a new alias for VERSION_ES6?

@gbrail
Copy link
Collaborator Author

gbrail commented Dec 14, 2024 via email

Add VERSION_ECMASCRIPT, which is clearer.
@gbrail
Copy link
Collaborator Author

gbrail commented Dec 15, 2024

Check it out -- I switched to VERSION_ECMASCRIPT and kept the old name for compatibility. Thanks for looking at it!

@gbrail gbrail marked this pull request as ready for review December 15, 2024 01:18
* <p>As of version 1.8, the Rhino community has no plans to continue to add new language
* versions, but instead plans to track the ECMAScript standard and add new features as the
* language evolves in new versions of Rhino, like other JavaScript engines. Projects that use
* Rhino are encouraged to migrate to the {@link #VERSION_ES6} version and stop relying on older
Copy link
Collaborator

@rbri rbri Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{@link #VERSION_ES6} -> {@link #VERSION_ECMASCRIPT} ?

@rbri
Copy link
Collaborator

rbri commented Dec 16, 2024

What about deprecating some of the older versions, including the plan to remove them in some time

@gbrail
Copy link
Collaborator Author

gbrail commented Dec 17, 2024

Can we address deprecating some releases in a future issue or PR? Personally I'd like to get rid of pretty much all of that version checking stuff but I have a feeling that will prevent many projects from upgrading to a recent release of Rhino. I'd love to hear how others feel.

@gbrail gbrail merged commit ba55268 into mozilla:master Dec 17, 2024
3 checks passed
@gbrail gbrail deleted the greg-default-version branch December 17, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants