couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1302) Fix couchjs
Date Wed, 05 Oct 2011 23:14:29 GMT

    [ 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

        

Mime
View raw message