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

ECMAScript 7 Support

    XMLWordPrintable

Details

    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:

      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:

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-47735
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes