-
Notifications
You must be signed in to change notification settings - Fork 395
Deprecate support for ECMAScript 5.1. #5128
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
Conversation
bf11623
to
4b42414
Compare
Looks like no one negatively reacted for 3 weeks, despite linking to this PR from all the usual places. @gzm0 Let's do it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed :)
@@ -87,6 +86,10 @@ final class ClosureLinkerBackend(config: LinkerBackendImpl.Config) | |||
case ESVersion.ES2020 => ECMASCRIPT_2020 | |||
case ESVersion.ES2021 => ECMASCRIPT_2021 | |||
|
|||
// Test for ES5_1 without triggering the deprecation warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so sad :((
Consider adding the full string ESVersion.ES5_1
in the comment for a bit better greppability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I also added a comment referring to here at the definition site of ES5_1
.
That support is the biggest source of alternative code paths and polyfills in our codebase. The polyfills and other alternative implementations we need to support ES 5.1 include: * `Math.fround` to support `Float` operations (in `CoreJSLib`). * Other bit manipulation magic for floating-point numbers (in `FloatingPointBits`). * Using dynamic JS `Array`s instead of typed arrays for Scala `Array`s of primitive types. * Using custom Java `Map`s instead of `js.Map`. * Various implementations of math methods in `jl.Math` (although these may come back for a Wasm-only target, along with more of them). * Using run-time generated random property names instead of `Symbol`s. * Very complex code to handle surrogate pairs in `ju.regex.*`. * (Imperfect) desugaring of `...rest` parameters and `...spread` operators. Moreover, the ES 5.1 output does not even have exactly the same semantics as later versions: * JS classes are not true `class`es. Notably, that means they cannot extend native ES classes, and they do not inherit static members. * Top-level exports are declared as `var`s instead of `let`s. 10 years after the instruction of ECMAScript 2015, I believe it is time to deprecate the support for Es 5.1, so that we can eventually remove it.
4b42414
to
a4cdc6
8B62
f
Compare
That support is the biggest source of alternative code paths and polyfills in our codebase.
The polyfills and other alternative implementations we need to support ES 5.1 include:
Math.fround
to supportFloat
operations (inCoreJSLib
).FloatingPointBits
).Array
s instead of typed arrays for ScalaArray
s of primitive types.Map
s instead ofjs.Map
.jl.Math
(although these may come back for a Wasm-only target, along with more of them).Symbol
s.ju.regex.*
....rest
parameters and...spread
operators.Moreover, the ES 5.1 output does not even have exactly the same semantics as later versions:
class
es. Notably, that means they cannot extend native ES classes, and they do not inherit static members.var
s instead oflet
s.10 years after the instruction of ECMAScript 2015, I believe it is time to deprecate the support for Es 5.1, so that we can eventually remove it.
I did a simulation of all the things we could drop if we indeed removed support for ES 5.1 in the future. It is visible in #5129.