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 E28732E36 for ; Thu, 5 May 2011 15:49:47 +0000 (UTC) Received: (qmail 84358 invoked by uid 500); 5 May 2011 15:49:45 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 84291 invoked by uid 500); 5 May 2011 15:49:45 -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 84227 invoked by uid 99); 5 May 2011 15:49:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 15:49:45 +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 15:49:43 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 09D0EC2FE3 for ; Thu, 5 May 2011 15:49:04 +0000 (UTC) Date: Thu, 5 May 2011 15:49:04 +0000 (UTC) From: "Caolan McMahon (JIRA)" To: dev@couchdb.apache.org Message-ID: <957759975.24914.1304610544036.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 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-1075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029389#comment-13029389 ] Caolan McMahon commented on COUCHDB-1075: ----------------------------------------- 1. I didn't want to replace the source of the module with a function and loose that information, so I tried adding a compiled property to the string (the same approach used in mikeal's patch: https://issues.apache.org/jira/browse/COUCHDB-890) but because strings are not passed around by reference, you can't extend the string object on the design doc with a new property easily... in fact I don't think that patch even works. Adding a _module_cache property seemed like the simplest way to store compiled modules without restructuring lots of code without much test coverage (and it lead me to fixing errors in the ways module ids are defined and module resolution works). 2. Circular dependencies are handled like this in every other environment I can think of. In fact node.js does exactly the same... but you'll see similar behaviour from Python and others. I think developers will expect CouchDB to behave in the same way. Thanks again for the feedback Alexander :) > 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