On 16 January 2012 14:20, Andrea Giammarchi <andrea.giammar...@gmail.com>wrote:

> var module = require("module");
>
> is totally fine but
>
> require("module", function (module) {
>   // is totally fine too
> });
>
> latter could be synchronous in node.js and asynchronous in the web, who
> cares, as long as it scales for all scenarios ... don't you agree?
>

One fundamental difference between how AMD modules and CommonJS modules
(presumably Node) load is that CommonJS modules have lazy initialization,
whereas AMD modules have eager initialization.

This is probably where some of the Node<>AMD "impedance mismatch" is coming
from -- in CommonJS with Modules/1.0 on the server side, developers expect
to be able to perform certain types of initialization when the module is
loaded, and they do not expect to need to pre-declare their modules.

It will be interesting to see how the addition of ES.Next modules plays out
with the server-side JS communities.

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to