incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <agri...@google.com>
Subject Circular require()s
Date Mon, 20 Aug 2012 17:12:42 GMT
Our module system currently allows cycles. However, the result of a cycle
is often not what you'd want. What we do when defining modules is:

module.exports = {};
factory(module) // either adds properties to or clobbers module.exports
return module.exports;

So, cycles in require()s will work only when:
a) exports is extended instead of clobbered, and
b) the result of the require is not used at the modules scope.

I think these restrictions are too hard to get right, and that we should
just make require cycles an error. Objections?

Andrew

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message