Skip to content

iojs --harmony_modules flag #518

Closed
Closed

Description

@krnlde

Hey guys,
it seems that I am the only one who wanted to fiddle around with es6 modules recently which are -yes I know- work in progress, but still. Since the docs aren't entirely clear about the current state of the es6-modules-implementation and the actual implementation proposal doesn't work I was wondering what the current state of the --harmony_modules flag is? Other than that you guys did an awesome job pushing node.js to its best. Thanks!

Greets, krnl

Activity

  1. ruimarinho commented on Jan 19, 2015

    @ruimarinho

    Afaik, --harmony_modules is a very much in progress feature on V8. While it is currently listed as "in progress", I find very little references to it on the source code. I think we are still a long way off having ES6 module support on io.js. There are some interesting shims though if you want to experiment a bit.

  2. krnlde commented on Jan 19, 2015

    @krnlde
    Author

    Thanks for the fast response. Yes traceur and 6to5 et al do their job, but I was hoping to finally remove that transpile-step.

    Well then. Thank you anyways! :)

    For everyone interested in the current state of es6-modules, follow this link.

  3. ruimarinho commented on Jan 19, 2015

    @ruimarinho

    There was a very interesting discussion on 6to5 regarding modules interop (babel/babel#95), which is something that will be a concern to every module author in the future.

  4. krnlde commented on Jan 19, 2015

    @krnlde
    Author

    Interesting indeed! Nice follow up. Thanks for ruining my night while reading the complete discussion :)

  5. speedneeder commented on Jan 20, 2015

    @speedneeder

    I found a page listed a compatibility table.
    http://kangax.github.io/compat-table/es6/

    I'm not sure how credible is it in this table about iojs.

    In my test code I found I can use yield key word in iojs, but iterator are not supported in iojs.

  6. ruimarinho commented on Jan 20, 2015

    @ruimarinho

    @speedneeder I was the one submitting the results for io.js. Iterators are supported by io.js. Example from MDN:

    function makeIterator(array){
      var nextIndex = 0;
    
      return {
        next: function(){
          return nextIndex < array.length ?
            { value: array[nextIndex++], done: false } : { done: true };
           }
        };
    }
    
    var it = makeIterator(['yo', 'ya']);
    
    console.log(it.next().value); // 'yo'
    console.log(it.next().value); // 'ya'
    console.log(it.next().done);  // true
  7. yosuke-furukawa commented on Jan 20, 2015

    @yosuke-furukawa
    Member

    I would like to request this issue to tc-agenda.
    If harmony_module is implemented by v8, How npm will resolve module names.

    npm/npm#4323
    https://gist.github.com/domenic/4748675

  8. speedneeder commented on Jan 20, 2015

    @speedneeder

    @ruimarinho
    I have read some tutorial about iterator of javascript, it gives some code like below, and I test it in firefox, it works:

    var lang = { name: 'JavaScript', birthYear: 1995 };
    var it = Iterator(lang);
    var pair = it.next(); //["name", "JavaScript"]
    console.log(pair);

    but when I run it with iojs, it says:

        var it = Iterator(lang);
                 ^
    ReferenceError: Iterator is not defined
        at Object.<anonymous> (F:\Study\node.js\netspider\test.js:2:14)
        at Module._compile (module.js:446:26)
        at Object.Module._extensions..js (module.js:464:10)
        at Module.load (module.js:341:32)
        at Function.Module._load (module.js:296:12)
        at Function.Module.runMain (module.js:487:10)
        at startup (node.js:111:16)
        at node.js:809:3
    

    It seems like the key word "Iterator" is not supported in iojs.

  9. krnlde commented on Jan 20, 2015

    @krnlde
    Author

    Don't you think this is a bit off-topic here?

  10. domenic commented on Jan 21, 2015

    @domenic
    Contributor

    V8 has not started implementing modules at all.

  11. vkurchatkin commented on Jan 21, 2015

    @vkurchatkin
    Contributor

    @domenic well, this works:

    require('vm').runInThisContext(`
      module B {
        export let a = 42;
      }
    `);

    Whatever it is

  12. domenic commented on Jan 21, 2015

    @domenic
    Contributor

    Yes, that is not ES6, that is from a few years ago before ES6.

  13. Fishrock123 commented on Jan 22, 2015

    @Fishrock123
    Contributor

    What @domenic said. (This is not implemented in v8 yet.)

  14. krnlde commented on Jan 22, 2015

    @krnlde
    Author

    Thanks guys!

  15. vkurchatkin commented on Jan 28, 2015

    @vkurchatkin
    Contributor

    something is happening: v8/v8@aeb3a71

  16. krnlde commented on Feb 2, 2015

    @krnlde
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions