ModuleImport

Rob Sayre sayrer at gmail.com
Wed Jul 2 20:24:44 PDT 2014


On Wed, Jul 2, 2014 at 3:29 PM, Brian Di Palma <offler at gmail.com> wrote:

> > The arguments for and against supporting cyclic dependencies seem to be
> academic. I'm yet to see any evidence of their importance in practice nor
> proof they they are fundamental ... or not.
>
> Support for them is needed, and what CommonJS has is not good enough.
> They are acknowledged in the modules documentation for node
> http://nodejs.org/api/all.html#all_cycles
> This does not mean they are recommended, the same holds true for ES6
> modules.
>
> It is an acceptance of the reality of complex and large codebases that
> sometimes cyclic dependencies can occur.
>

That's awesome--I didn't know that node had arrived at exactly the same
solution as Firefox did. It even uses the same test file names. Node's
module system has way more users, and Firefox's is twice as old.

Here's the 7-year old test for it:

http://hg.mozilla.org/mozilla-central/annotate/38ecfc3922b8/js/xpconnect/tests/unit/test_recursive_import.js

I wrote that, but I didn't have any conceptual insight. All I did was go
"what does python do" and made the Mozilla JS engine do that. I think
that's the critical disconnect in this thread--we have the ability to
change the JS implementations, so we're not fenced in by the way JavaScript
currently works. The authors of node.js and Firefox arrived at that
conclusion, anyway.

- Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140702/f80a9f49/attachment.html>


More information about the es-discuss mailing list