Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
None
Description
The latest version of the ECMAScript spec, ECMAScript 2015 (formerly called ECMAScript 6) has been finalized and it would be wonderful to be able to use the features it brings to Javascript in QML, especially:
- Block scoped variables using "let" instead of "var"
- Constants
- Template Strings - multiline strings without needing to concat strings, and inlining variables like this: `This is a string with a ${variable} in it!`
- "Arrow functions", simple anonymous functions that look like this: `argument => doSomething(argument)`. Also uses a lexical `this` in the body of the function.
- Classes
- Generators
- Destructuring
I don't know if QML can support ES2015 modules - that might conflict with its use of the import keyword.
Folks can try out ES2015 features in-browser here using the Babel transpiler:
Transpiling stuff with Babel works great on a lot of features, but things like block scoping and constants would work a lot better if it was supported natively in the engine.
Some interesting reading material:
- https://babeljs.io/docs/learn-es2015/
- https://hacks.mozilla.org/category/es6-in-depth/
- http://www.2ality.com/2015/02/es6-classes-final.html (also a ton more articles on ES2015 on this blog)
- https://github.com/ericdouglas/ES6-Learning
- A huge in-depth book on ES2015: http://exploringjs.com/
Attachments
Issue Links
- depends on
-
QTBUG-68545 New Map and Set implementations in QML do not have sufficient performance characteristics
- Closed
-
QTBUG-54121 Add support for ECMA6 Proxy to QJSEngine / v4vm
- Closed
- relates to
-
QTBUG-25942 Some way to get base type members
- Open
-
QTBUG-22356 Investigate support for 3rd party JS libraries
- Closed
-
QTBUG-36875 ES6: Support "for...of"
- Closed
- resulted in
-
QTBUG-71389 Add support for QML module imports in ES Modules
- Open
Gerrit Reviews
For Gerrit Dashboard: QTBUG-47735 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
215213,2 | WIP: QQmlJS: Lexing and parsing for template literals | dev | qt/qtdeclarative | Status: ABANDONED | -2 | 0 |