Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequences and selectors leak child values #3

Open
eykd opened this issue Dec 16, 2014 · 1 comment
Open

Sequences and selectors leak child values #3

eykd opened this issue Dec 16, 2014 · 1 comment
Labels

Comments

@eykd
Copy link
Owner

eykd commented Dec 16, 2014

The #2 PR appears to have dredged up a bunch of problems. In mucking around with parallel I've realized that sequence and selector leak child return values:

        tree = owyl.sequence(owyl.succeed(),
                             owyl.succeed(),
                             owyl.fail(),
                             owyl.succeed())
        v = owyl.visit(tree)

        results = [x for x in v if x is not None]
        self.assertEqual(results, [True, True, False, False])

See how the succeed()/succeed()/fail() leaks out to the results? The first three results are from the sequence children, while the 4th result is the sequence itself failing.

It's been a few years since I designed this library, but I can't think for the life of me why they would do that. Do any of you using owyl depend on this behavior?

@eykd eykd added the bug label Dec 16, 2014
@Gaboose
Copy link

Gaboose commented Dec 16, 2014

The tests do:

def testVisitSequenceSuccess(self):
        """Can we visit a successful sequence?
        """
        tree = owyl.sequence(owyl.succeed(),
                             owyl.succeed(),
                             owyl.succeed())

        v = owyl.visit(tree)

        results = [x for x in v if x is not None]
        self.assertEqual(results, [True, True, True, True])

I thought this was what owyl.visit was supposed to do, because it visits each node :) I think I can say the Hanson Robotics folk don't depend on visit's yield values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants