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

StopTraversal behaviour not consistent in nested chains #8

Closed
maxfischer2781 opened this issue Jan 24, 2018 · 3 comments
Closed

StopTraversal behaviour not consistent in nested chains #8

maxfischer2781 opened this issue Jan 24, 2018 · 3 comments

Comments

@maxfischer2781
Copy link
Owner

The behaviour of StopTraversal is not consistent in send, nested or parallel execution. The described purpose is

  • Stop the traversal of a path, with either
    • [1] No return value
    • [2] a final return value

Processing multiple sub-chains in chains fails to do [2], treating early return values as regular ones. A bundle behaves similarly.

A bare send will retry indefinitely in case of [1], until either a result is produced (regularly or via [2]) or StopIteration. This easily creates an infinite loop for inappropriate input, or non-defensive chains.

@maxfischer2781
Copy link
Owner Author

The major problem is consistently applying [2] in nested structures. This may require splitting the result list into active and final values. No idea for a consistent design that does not require chainlets to be aware of the split.

The behaviour of [1] could be adjusted for consistency with send: Breaking a flat chain should be consistent with a bare yield, producing None. This implies that breaking a forking chain produces an empty iterable, i.e. () or []. A StopIteration is not caught.

@maxfischer2781
Copy link
Owner Author

The functionality of [2] may be expressed with an explicit control structure. Instead of

a >> break_or_cont >> tail

an explicit switch as in

a >> either(break, cont >> tail)

@maxfischer2781
Copy link
Owner Author

Should be fixed since v1.3.0.

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

No branches or pull requests

1 participant