`import` and hoisting

Axel Rauschmayer axel at rauschma.de
Fri Mar 20 18:20:00 UTC 2015


As far as I can tell, `import` is hoisted (due to `ModuleDeclarationInstantiation`). Is the following code OK, then? No temporal dead zone?

```js
bar();

import {foo} from 'mymodule';

function bar() { // hoisted!
    foo(); // already initialized?
}
```

How about this code?

```js
foo();

import {foo} from 'mymodule';
```

Thanks!

Axel

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150320/b06514f0/attachment.html>


More information about the es-discuss mailing list