On Sun, Dec 1, 2013 at 6:01 PM, Nathan Breit <[email protected]> wrote:

> After seeing the task.js library it struck me that the same approach could
> also be used used to import modules. For example:
>
> let JSON = yield load('http://json.org/modules/json2.js');
>
> This provides some of the benefits of the new module syntax; there is no
> need to wrap everything in a function, and imported variables can be
> defined inline with their library path for easy copy/pasting. However, the
> new syntax has other benefits this approach doesn't such as readability and
> it might interfere with concurrent loading/pre-fetching.
>
The `yield` keyword is not allowed outside of generator functions, so that
line would need to be wrapped. The `load` function needs to be defined and
it would have to use a script element or xhr, but would ultimately the
contents will be executed in the global scope (as is done today). Modules
avoid all of these issues.


Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to