2013-04-01

ECMAScript Harmony features in Node.js

Quick tip (via David Klassen): The following shell command lists all (highly experimental!) ECMAScript Harmony [1] features that can be switched on in Node.js.
    node --v8-options | grep harmony
For example, Node.js 0.10.2 supports:

--harmony_typeofenable harmony semantics for typeof
--harmony_scopingenable harmony block scoping
--harmony_modulesenable harmony modules (implies block scoping)
--harmony_proxiesenable harmony proxies
--harmony_collectionsenable harmony collections (sets, maps, and weak maps)
--harmonyenable all harmony features (except typeof)

Note: “harmony semantics for typeof” is something that (unfortunately) had to be rejected for Harmony. It would have consisted of typeof null returning 'null', but that change would break too much existing code.

Reference:

  1. ECMAScript: ES.next versus ES 6 versus ES Harmony

No comments: