couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Howe (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1397) Function expressions, evals in SpiderMonkey
Date Fri, 03 Feb 2012 14:55:54 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13199747#comment-13199747
] 

James Howe commented on COUCHDB-1397:
-------------------------------------

There's nothing "Invalid" about this javascript: {"map": "function(doc) {}"}, it's only the
way it's used (i.e. blindly eval'd) that is invalid. A source-to-source translation cold be
s/\bfunction\(/function map(/.

IMO, it is the people writing {"map": "var d=1; function(doc) { emit(doc._id, d);"} that should
find their code not working, as they are using undocumented features.

If changes are to be made, I much prefer Benoit's suggestion - having "doc" be implicit in
the context and the value of "map" keys being function bodies. "emit" already works like this,
so makes no difference to JSLintability.


                
> Function expressions, evals in SpiderMonkey
> -------------------------------------------
>
>                 Key: COUCHDB-1397
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1397
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.2.1
>         Environment: All
>            Reporter: Jason Smith
>
> New SpiderMonkey releases do not eval() a sole anonymous function expression. That is
not a valid JavaScript statement, and so it is not a valid JavaScript script.
> COUCHDB-1302 addressed this for 1.1 and the 1.1.x branch. This ticket is for 1.2. (Sorry
to spam COUCHDB-1302. I saw "Unassigned" and read "Unresolved.")

--
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