Skip to content

Variable shadowing #546

Closed
Closed

Description

@al3xandru

The following query doesn't work:

r.expr(['alex', 'slava']).concatMap(
  function(e) { return r.table('linuxdynasty').filter(
     function(doc) { return doc('name').eq(e) }) 
  }
)

Another query that shows the problem is:

r.expr(['alex', 'slava']).concatMap(
  function(e) { return r.table('linuxdynasty').map(function(m2) { return e}) })

which returns m2 instead of e

Activity

  1. ghost assigned on Mar 28, 2013
  2. jdoliner commented on Mar 28, 2013

    @jdoliner
    Contributor

    Does this work in other clients?

  3. wmrowan commented on Mar 29, 2013

    @wmrowan
    Contributor

    It works in Python. This strongly suggests that it's a problem with how the JS driver is assigning argument names.

  4. wmrowan commented on Mar 29, 2013

    @wmrowan
    Contributor

    Yeah, so this was just a complete and total oversight on my part. The var-id counter is reset for each function. I'll also add some polyglot tests for this.

  5. mglukhovsky commented on Mar 29, 2013

    @mglukhovsky
    Member

    @wmrowan, is there a fix already in the works or in code review?

  6. wmrowan commented on Mar 29, 2013

    @wmrowan
    Contributor

    It's in code review as we speak. Review 315. Still in the "waiting for comments phase" though. Do you want to review it?

  7. wmrowan commented on Mar 29, 2013

    @wmrowan
    Contributor

    This is now merged into next and 1.4.x. Review 315.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions