Harmony modules

# Jorge (12 years ago)

On 01/06/2013, at 23:57, Fran?ois REMY wrote:

Arrow functions probably shouldn't be used for this, this is not very readable.

Yeah, arrow functions are grawlix-y per se, but I've come to admit that Brendan (et al) was (were) right: they're going to be a Good Part™.

I think you should have a look at modules, this is what is expected to replace this pattern ;-)

I understand node modules perfectly but everything I've seen in es-discuss about the modules proposal was almost incomprehensible (for me). Do you know of a harmony-modules-for-dummies doc or video that I can read/see to learn more? :-)

How would I turn this IIFE into an inlined module?

var myModule= (()=>{
  //...
  return someThing;
})();

Also, in node the modules are read synchronously from a disk drive, how can these new es6 modules deal with modules that have to be read from the network when is JS there's no means for IO?

# Brian Di Palma (12 years ago)

Based on my understanding of modules ( so this may well be wrong ) where you want to use the module you would write

import someThing from "mymodulefile"

and inside mymodulefile.js, the file that exports the resource you want to use, you would do

function someThing(){}

export someThing;

and mymodulefile can be a physical file on your server or it can be mapped to another resource by using the Loader.ondemand method. In the environment that runs the JS there is a mechanism for IO - it's the environment that provides loading capabilities.