incubator-couchdb-dev mailing list archives

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

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

Benoit Chesneau commented on COUCHDB-1397:
------------------------------------------

Having a json which would do { "views": "name": { "map": "function map(doc) {}"}} is somehow
inelegant and redundant imo. 

The other solution { "views": "name": "function map(doc) {} .. function reduce(doc) {}" }
may be confusing:

- I can introduce the idea that people could share vars between this functions, while they
are used at different states. For example what would happen if smeone shatre the results of
the map function to the reduce function. 
- Since these functions are used at different steps, why sharing them in the same member ?

I think it may be better to keep the current split in different properties of the design doc.
I like the idea of elasticsearch to just pass script with a global context inside. 

we could have something like:

map = "some script" which could base a  Ctx object containing all the neded info:

ctx.doc
ctx.ddoc ...

then tue script could just return or emit.  

What do you think?

                
> 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