Juan Ignacio Dopazo (2014-02-03T14:45:54.000Z)
On Friday, January 31, 2014 8:10 PM, Calvin Metcalf <calvin.metcalf at gmail.com> wrote:

what I'm talking about would be sugar for something functionally equivalent to:
```js
import 'bar' as ___temp1;
import 'baz' as ___temp2;
var foo = Math.random() > 0.5 ? ___temp1 :___temp2;
```


I think it's good that imports are not expressions. It makes it a lot easier to analyze them statically.

These use cases are probably better solved at the Loader level. If I understood the spec correctly, If you have modules that you want to load conditionally you can set up a `normalize` hook that changes which module is actually loaded.

System.normalize = function (name) {
  if (name === 'bar' && Math.random() > 0.5') {
    return 'baz'
  }
  return name;
};

Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140203/cfd4fe6f/attachment-0001.html>
forbes at lindesay.co.uk (2014-02-04T10:45:48.309Z)
I think it's good that imports are not expressions. It makes it a lot easier to analyze them statically.

These use cases are probably better solved at the Loader level. If I understood the spec correctly, If you have modules that you want to load conditionally you can set up a `normalize` hook that changes which module is actually loaded.

```js
System.normalize = function (name) {
  if (name === 'bar' && Math.random() > 0.5') {
    return 'baz'
  }
  return name;
};
```