incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtan...@gmail.com
Subject Re: Circular require()s
Date Mon, 20 Aug 2012 17:21:25 GMT
+1

In most cases a circular require is not what you want
Sent on the TELUS Mobility network with BlackBerry

-----Original Message-----
From: Andrew Grieve <agrieve@google.com>
Date: Mon, 20 Aug 2012 13:12:42 
To: <callback-dev@incubator.apache.org>
Reply-To: callback-dev@incubator.apache.org
Subject: Circular require()s

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
View raw message