couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <>
Subject Re: [jira] [Created] (COUCHDB-1302) Fix couchjs
Date Thu, 06 Oct 2011 04:39:35 GMT
On Thursday, October 6, 2011, Jason Smith (Commented) (JIRA) <> wrote:
>    []
> Jason Smith commented on COUCHDB-1302:
> --------------------------------------
> Couch Javascript are expressions, not statements. Everything is an
implicit var map = eval( You put function
expressions in them. Helpers must go in inside. If helpers don't fit in new
couchjs, that can't be helped. It is not a breaking change so much, except
that couch permitted a convenient but severe syntax error and now it
> One can also argue that the place for helper code is CommonJS modules.
> We discussed parsing JS with uglify.js and identifying the final function
defined. This allows unmodified ddocs to work. But developers communicate to
CouchDB extremely implicitly and through an invisible mechanism. It feels
like "being an enabler."
> Assuming uglify.js can do it, how would you feel about a correction tool
which converts bad code to good code? We could test it in the real world as
a couchapp or web service that converts bad ddocs to good ddocs. If it works
well, maybe even bundle it into couchjs and couch could be told to correct
the errors. When asked, couch could feed the design doc to couchjs with the
uglify fixer tool and update the ddoc with the correction. Maybe
/_config/couchdb/fix_my_js = true. The fix could run when ddocs are read, or
perhaps saved, or who knows! even during compaction.
> This is a crazy idea but IMO less crazy than permitting invalid Javascript
that upstream code has sought to eliminate. To me the best trade-off is to
mark it in the change log and provide third-party tools to correct ddocs.

if we do that it would imply the release of a major version since the change
is major. I'm +1 to introduce correct behaviour in trunk rather than trying
to hack arouind our own insanity.
>> Fix couchjs
>> -----------
>>                 Key: COUCHDB-1302
>>                 URL:
>>             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:
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> For more information on JIRA, see:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message