Brendan Eich (2013-12-01T23:38:20.000Z)
domenic at domenicdenicola.com (2013-12-10T01:11:01.042Z)
Nathan Breit wrote: > After seeing the task.js library it struck me that the same approach > could also be used used to import modules. For example: > > ```js > 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, > But yield cannot be used as you show except in `function*` (a generator 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. > Right. task.js/generators and the loader API (or XHR or other such) go together; we also want the import special form. Both play their parts, one can't express one with the other or vice versa.
domenic at domenicdenicola.com (2013-12-10T01:10:51.806Z)
Nathan Breit wrote: > > After seeing the task.js library it struck me that the same approach > could also be used used to import modules. For example: > > ```js > 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, > But yield cannot be used as you show except in `function*` (a generator 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. > Right. task.js/generators and the loader API (or XHR or other such) go together; we also want the import special form. Both play their parts, one can't express one with the other or vice versa.