[Intent to implement] ES6 in Chrome's JS and tools (NOT: v8 support of new lang features)

100 views
Skip to first unread message

Dan Beam

unread,
Dec 7, 2016, 8:28:13 PM12/7/16
to Chromium-dev
Summary
I'm planning on adding ECMAScript6 (ES6) support in Chrome's JavaScript code.  Examples of proposed features are here.

Tracking bug
crbug.com/671426

Details

Motivation
Why do we need ES6 support in Chrome's JS?
  • it'd unblock us from using Polymer 2 (especially for Material Design UIs)
    • likely to shrink installer size and have runtime performance gains
  • web APIs are being spec'd requiring ES6 (i.e. customElements.define), but our tools don't support it (or we don't know if they do)
  • ES6 improves upon many parts of ES5 and earlier
  • we already use some ES6 things (Promise, typed arrays) with minimal guidance
  • Google has made huge strides in ES6 support internally, so we get a lot of stuff for free (i.e. ES6 support in closure compiler)
  • many people have been asking for it forever
Platforms
All.  Heaviest users of JS in Chrome are probably web-based UIs, iOS, and maybe mojo?  Nobody would be required to use ES6 features, but they'd know which ones work (and in which tools and environments) and which features are a good fit for Chrome code (and why).

Schedule and rollout plan
My plan is to roughly follow the 
C++11 process by starting with a list of features (currently here) and discuss each feature in priority order.  Current high value ES6 features:
  • class syntax (unblocks Polymer 2)
  • => (fixes many classes of errors)
  • let (block scope)
  • const
It's not clear yet whether we should discuss each feature on chromium-dev@ or make an ES6 equivalent of c...@chromium.org (where C++11 discussions are now directed).  Thoughts?

We will likely need to audit each new feature's compliance with our existing tools:
  • closure linter (runs on presubmit)
  • closure compiler
For Material Design (Polymer) UIs:
  • vulcanize
  • uglify
  • crisper
and determine support on iOS (non-v8).

I'm also planning to modernize the existing, inconsistently formatted, and kinda stale web development styleguide into:

  /src/styleguide/web/
    css.md
    html.md
    js.md
    polymer.md (?)

and update the root styleguide.  Eventually, I think we'd want to merge es6_features.md into js.md (or keep it separate but move to the same directory).

Experiments
N/A

Risks
Instability, performance problems, or breakage of new code that uses ES6.

-- Dan

dpapad

unread,
Dec 7, 2016, 8:43:39 PM12/7/16
to Chromium-dev
I am very excited to see this effort kick-off!

ES6 will greatly benefit our code's health and quality. Actually it already has, via the use of Promises. Just as the pre-Promise world seems like a distant and dark time, I envision that the current pre-ES6 "class", "let", "arrow functions" (etc) state, will quickly fade into the past, making Chromium developers happier.

PhistucK

unread,
Dec 8, 2016, 12:36:44 PM12/8/16
to Dan Beam, Chromium-dev
Cool! :)

Though, not ES6 (no such thing). :( ECMAScript 2015, or ES2015 (or ES'15? Meh).

I have written in ECMAScript 2015 for some time now and it really makes writing JavaScript much more enjoyable. My favorite part is destructuring (not a new idea, I know). :)

In the Promise example, it looks like loaded.then should be fullyLoaded.then. :)

Examples for Object.is -
Object.is(null, null) // true
Object.is(NaN, NaN) // true
-0 === +0 // true
Object.is(-0, +0) // false

As a side note, I was quite surprised by -
Reflect.ownKeys(obj);  // ['a', 'b', Symbol(c)]


PhistucK

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Rafał Chłodnicki

unread,
Dec 8, 2016, 1:37:35 PM12/8/16
to phis...@gmail.com, Dan Beam, Chromium-dev
Should also list await/async which is often much cleaner to use than plain promises.

PhistucK

unread,
Dec 8, 2016, 2:14:45 PM12/8/16
to Rafał Chłodnicki, Dan Beam, Chromium-dev
Yeah, but it would be a while before it comes to iOS.


PhistucK

Rachel Blum

unread,
Dec 8, 2016, 3:20:47 PM12/8/16
to PhistucK, Rafał Chłodnicki, Dan Beam, Chromium-dev
async/await are not a part of ES6 :) 

As for the bug fixes, please help us out and submit CLs (src/docs/es6_chromium.md)


PhistucK

unread,
Dec 8, 2016, 4:04:24 PM12/8/16
to Rachel Blum, Rafał Chłodnicki, Dan Beam, Chromium-dev
Change lists require depot tools and all of the things, so, sorry, but no.
Maybe when I finally acquire a development machine.


PhistucK

Elliott Sprehn

unread,
Dec 8, 2016, 8:52:17 PM12/8/16
to PhistucK, Rachel Blum, Rafał Chłodnicki, Dan Beam, Chromium-dev
We really do need a way to edit the md files from a web browser. This is a huge downside of not using the wiki now.

Nico Weber

unread,
Dec 8, 2016, 9:13:00 PM12/8/16
to Elliott Sprehn, Andrew, PhistucK, Rachel Blum, Rafał Chłodnicki, Dan Beam, Chromium-dev
I was told that the ability to edit md files online would happen for the docs/ transition. Andy, what's the status of that?

Dirk Pranke

unread,
Dec 8, 2016, 9:17:34 PM12/8/16
to Nico Weber, Elliott Sprehn, Andrew, PhistucK, Rachel Blum, Rafał Chłodnicki, Dan Beam, Chromium-dev
Nope, we didn't get that and we're not going to get that any time soon.

We'll be able to get closer to this when we switch to PolyGerrit, as
PG (and Gerrit itself) has at least some rudimentary support for editing CLs 
in-page. But, I think there's probably more work that needs to be done before
we get a real cloud-based editor.

(This was a known tradeoff that was made at the time.)

-- Dirk

Andrew Bonventre

unread,
Dec 8, 2016, 9:20:51 PM12/8/16
to Dirk Pranke, Nico Weber, Elliott Sprehn, Andrew, PhistucK, Rachel Blum, Rafał Chłodnicki, Dan Beam, Chromium-dev
Preempted by other work. Once we switch to Gerrit, creating CLs programmatically from the source browser is on AlphaSource’s roadmap.


PhistucK



PhistucK



PhistucK

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

PhistucK

unread,
Dec 9, 2016, 9:23:12 AM12/9/16
to Andrew Bonventre, Dirk Pranke, Nico Weber, Elliott Sprehn, Rachel Blum, Rafał Chłodnicki, Dan Beam, Chromium-dev
That would be so great. I might start contributing actual code rather than only triaging issues.
:)


PhistucK



PhistucK



PhistucK



PhistucK

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Dan Beam

unread,
Dec 13, 2016, 2:18:56 PM12/13/16
to PhistucK, Andrew Bonventre, Dirk Pranke, Nico Weber, Elliott Sprehn, Rachel Blum, Rafał Chłodnicki, Chromium-dev
On Fri, Dec 9, 2016 at 6:21 AM, PhistucK <phis...@gmail.com> wrote:
That would be so great. I might start contributing actual code rather than only triaging issues.
:)


PhistucK

On Fri, Dec 9, 2016 at 4:19 AM, Andrew Bonventre <andy...@chromium.org> wrote:
Preempted by other work. Once we switch to Gerrit, creating CLs programmatically from the source browser is on AlphaSource’s roadmap.

On Thu, Dec 8, 2016 at 6:16 PM Dirk Pranke <dpr...@chromium.org> wrote:
Nope, we didn't get that and we're not going to get that any time soon.

We'll be able to get closer to this when we switch to PolyGerrit, as
PG (and Gerrit itself) has at least some rudimentary support for editing CLs 
in-page. But, I think there's probably more work that needs to be done before
we get a real cloud-based editor.

(This was a known tradeoff that was made at the time.)

-- Dirk

On Thu, Dec 8, 2016 at 6:11 PM, Nico Weber <tha...@chromium.org> wrote:
I was told that the ability to edit md files online would happen for the docs/ transition. Andy, what's the status of that?

On Thu, Dec 8, 2016 at 8:50 PM, Elliott Sprehn <esp...@chromium.org> wrote:
We really do need a way to edit the md files from a web browser. This is a huge downside of not using the wiki now.

I agree it'd be super.
 

On Thu, Dec 8, 2016 at 1:02 PM, PhistucK <phis...@gmail.com> wrote:
Change lists require depot tools and all of the things, so, sorry, but no.
Maybe when I finally acquire a development machine.


PhistucK

On Thu, Dec 8, 2016 at 10:19 PM, Rachel Blum <gr...@chromium.org> wrote:
async/await are not a part of ES6 :) 

As for the bug fixes, please help us out and submit CLs (src/docs/es6_chromium.md)



On Thu, Dec 8, 2016 at 11:12 AM, PhistucK <phis...@gmail.com> wrote:
Yeah, but it would be a while before it comes to iOS.


PhistucK

On Thu, Dec 8, 2016 at 8:36 PM, Rafał Chłodnicki <rchlo...@opera.com> wrote:
Should also list await/async which is often much cleaner to use than plain promises.

On Thu, Dec 8, 2016 at 6:35 PM, PhistucK <phis...@gmail.com> wrote:
Cool! :)

Though, not ES6 (no such thing). :( ECMAScript 2015, or ES2015 (or ES'15? Meh).

Address the new language features however you'd like.  I just find "ES6" shorter.  The official spec has a lot of numbers and terms and things ;)

Standard ECMA-262
6th Edition / June 2015
ECMAScript® 2015 Language Specification

-- Dan

Dan Beam

unread,
Dec 13, 2016, 6:02:32 PM12/13/16
to PhistucK, Rachel Blum, Rafał Chłodnicki, Chromium-dev
On Thu, Dec 8, 2016 at 1:02 PM, PhistucK <phis...@gmail.com> wrote:
Change lists require depot tools and all of the things, so, sorry, but no.
Maybe when I finally acquire a development machine.

I fixed these things and added an Object.is() example here, btw:
https://codereview.chromium.org/2574833002/

I haven't heard any objections to this thread, so I'm going to start proposing features soon.

-- Dan
Reply all
Reply to author
Forward
0 new messages