whatwg / loader

Loader Standard
https://whatwg.github.io/loader/
Creative Commons Zero v1.0 Universal
607 stars 45 forks source link

[question] `Instantiation(loader, result, source)` will assume `result` is callable in step 3, but `result` is just an exotic namespace object that is not callable. #115

Closed caridy closed 8 years ago

caridy commented 8 years ago

loader.js implementation feedback

caridy commented 8 years ago

resolution: it could be a factory for back-compat with dynamic module systems.

action: it should test for callable or module registry, and act accordingly.

caridy commented 8 years ago

solves as part of refactor https://github.com/whatwg/loader/pull/122

image

guybedford commented 8 years ago

Does this mean returning a factory in instantiate is no longer supported?

caridy commented 8 years ago

It is supported. Step 4 allows optionalInstance to be callable, then in https://whatwg.github.io/loader/#ensure-linked we guarantee that the factory is executed, and that it returns a namespace exotic object.

guybedford commented 8 years ago

Will read more carefully next time. Thanks for clarifying!