Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47735

ECMAScript 7 Support

XMLWordPrintable

      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:

      https://babeljs.io/repl/

      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:

        There are no Sub-Tasks for this issue.
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            laknoll Lars Knoll
            empyrical empyrical
            Votes:
            87 Vote for this issue
            Watchers:
            90 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes