You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Matt Goodall <ma...@gmail.com> on 2011/09/29 13:23:53 UTC

Warning: minor incompatability in the 1.1.x branch with map helper functions

Hi,

I just tested an app against the latest 1.1.x  branch and discovered
something annoying but easily fixable in a view.

I have a view with something like the following for the map part:

    function some_helper() {
      return "blah";
    }

    function(doc) {
      emit(doc._id, some_helper());
    }

Note how the some_helper func is defined *outside* the anonymous map
func. This used to work until the "Fix function evaluation by newer
SpiderMonkey's" commit (61f10e7590bd352b367ad426a56587cbef3700b6) on
27th Sept.

Now, I'm honestly not sure why I have a helper func outside the actual
map func - it certainly looks a bit weird - so I'm going to move it
inside. However, I'm fairly sure I saw that done somewhere else, so I
thought I'd post a quick warning in case it affects anyone else.

- Matt

Re: Warning: minor incompatability in the 1.1.x branch with map helper functions

Posted by Paul Davis <pa...@gmail.com>.
Try adding a semicolon between them. Although this is quite
unfortunate. I'm suddenly wondering if we shouldn't figure out a
different fix to the anonymous function evaluation.

On Thu, Sep 29, 2011 at 6:23 AM, Matt Goodall <ma...@gmail.com> wrote:
> Hi,
>
> I just tested an app against the latest 1.1.x  branch and discovered
> something annoying but easily fixable in a view.
>
> I have a view with something like the following for the map part:
>
>    function some_helper() {
>      return "blah";
>    }
>
>    function(doc) {
>      emit(doc._id, some_helper());
>    }
>
> Note how the some_helper func is defined *outside* the anonymous map
> func. This used to work until the "Fix function evaluation by newer
> SpiderMonkey's" commit (61f10e7590bd352b367ad426a56587cbef3700b6) on
> 27th Sept.
>
> Now, I'm honestly not sure why I have a helper func outside the actual
> map func - it certainly looks a bit weird - so I'm going to move it
> inside. However, I'm fairly sure I saw that done somewhere else, so I
> thought I'd post a quick warning in case it affects anyone else.
>
> - Matt
>