Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AFD35213D for ; Thu, 5 May 2011 16:33:43 +0000 (UTC) Received: (qmail 96226 invoked by uid 500); 5 May 2011 16:33:43 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 96158 invoked by uid 500); 5 May 2011 16:33:43 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 96141 invoked by uid 99); 5 May 2011 16:33:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 16:33:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 16:33:41 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 5F755C2556 for ; Thu, 5 May 2011 16:33:03 +0000 (UTC) Date: Thu, 5 May 2011 16:33:03 +0000 (UTC) From: "Alexander Shorin (JIRA)" To: dev@couchdb.apache.org Message-ID: <850657610.25128.1304613183387.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <329559333.10357.1298453378590.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1075) Circular require's in CommonJS modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029419#comment-13029419 ] Alexander Shorin commented on COUCHDB-1075: ------------------------------------------- 1. The question is actual because design doc function are cached in same way, so I just couldn't see any differences for modules. In fact of caching and dynamic language nature you could easily modify module nor any other function in same way and original code would be never executed once again to clean up this modifications. But this is on developers own conscience to use this feature or not(: 2. Actually for Python, circular imports at top module would failed because requested objects wouldn't be defined yet. Placing imports down below of module could solves this, but discouraged by PEP-8. However, you are right, because there is specification of this function: http://wiki.commonjs.org/wiki/Modules/1.1 and p.3 is the answer(: But I suppose that current realization of require function doesn't accords to this specs in questions of top level modules and relative one, because currently all imports are relative no matter how their have defined. > Circular require's in CommonJS modules > -------------------------------------- > > Key: COUCHDB-1075 > URL: https://issues.apache.org/jira/browse/COUCHDB-1075 > Project: CouchDB > Issue Type: Bug > Components: JavaScript View Server > Reporter: Caolan McMahon > Labels: javascript > Attachments: module_cache.diff > > > Having a CommonJS module A which requires B, when B also requires A causes the stack to fill up with require calls. A prerequisite for this fix is the caching of modules, even if it is only on a per-request basis. > Patch incoming. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira