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 D69139A00 for ; Wed, 5 Oct 2011 23:14:51 +0000 (UTC) Received: (qmail 76627 invoked by uid 500); 5 Oct 2011 23:14:51 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 76580 invoked by uid 500); 5 Oct 2011 23:14:51 -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 76572 invoked by uid 99); 5 Oct 2011 23:14:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2011 23:14:51 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,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; Wed, 05 Oct 2011 23:14:50 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id A00FA2AB880 for ; Wed, 5 Oct 2011 23:14:29 +0000 (UTC) Date: Wed, 5 Oct 2011 23:14:29 +0000 (UTC) From: "Paul Joseph Davis (Commented) (JIRA)" To: dev@couchdb.apache.org Message-ID: <89650080.1276.1317856469656.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <629043574.12649.1317835654298.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1302) Fix couchjs 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-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13121578#comment-13121578 ] Paul Joseph Davis commented on COUCHDB-1302: -------------------------------------------- So I sat down today to try and figure out this SpiderMonkey issue. After a chat with the guys on #jsapi they specifically said "wrap it in parens" when I asked. Though the issue is that it gets a bit more tricky. The situation is basically that we've apparently been using invalid JavaScript for the last four years. Specifically, a script like such is invalid: "function(){}" Sadly, that's how *all* of our callbacks are expected to be defined. When I mentioned this, the suggestion was exactly to wrap it in parens which is what I'd discovered on my own. This works fine except for that people that have defined functions outside the callback scope then hit issues. Ie: var f = function() {}; function() {f();}; Breaks when wrapped in parens. And it even breaks when not in parens because the anonymous function still needs to be wrapped like such: var f = function() {}; (function(){f();}) So, we're kinda up shit creek here. I'm still trying to figure out if there's anything we can do to save users pain, but the recommendation was basically, "It was fixed on purpose and its a hardcoded change that can't be configured." So, either we tell users "fix your functions" or we try and do some sort of source level analysis to wrap that last function, or something entirely different. Anyone else have Ideas? > Fix couchjs > ----------- > > Key: COUCHDB-1302 > URL: https://issues.apache.org/jira/browse/COUCHDB-1302 > Project: CouchDB > Issue Type: Improvement > Components: JavaScript View Server > Affects Versions: 1.1.1, 1.2, 1.3 > Reporter: Paul Joseph Davis > Priority: Blocker > > Figure out why some spidermonkeys have an error when doing: eval("function(){}") -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira