It would be helpful to see some more code, for example, is `query` ever 
exposed in the outside scope? Where is it referenced for usage rather than 
population?

On Tuesday, June 26, 2012 4:43:26 AM UTC-5, kuno wrote:
>
> This error occurs on node 0.6.19, not sure be fixed on 0.8 or not.
>
> suppose I have a nest function like this:
> <=======================================
> function outer() {
> var query = {};
> query.startkey = [];
> query.endkey = [];
>
> query.startkey.push('report');
> query.startkey.push({});
>
> var keysCallback =  function(result) {
>      query.startkey.push(result.key1);
>      query.startkey.push(result.key2);
>       ......
> }
>
> getResultFunction(args, keysCallback);
> }
> ======================================>
> most time, it works well, but in some very very rare chance, I got the 
> error like this:
>
> <=======================================
>
> Object ["report",{}] has no method 'push'
>
> ========================================>
> if we inspect it, it'll tell that query.startkeys is an object with the 
> array literal notation '["report",{}]', but not a real array.
>
> Since it occurs inside the inner keysCallback, but query.startkey was 
> defined explicitly in the outer function, and works well.
> This make methink maybe there are some runtime errors, during the runtime 
> lookup the query.startkeys from the scope of keysCallback to the outer 
> function.
>
> But I am not a expert on v8, so this is just a suspection. I'd like to 
> hear your opinion about this.
>
> --thanks
>
> kuno 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to