maxfischer2781 / chainlet

Python module for linking generators/iterators to processing chains
MIT License
1 stars 0 forks source link

Premature end of Chain traversal #5

Closed maxfischer2781 closed 7 years ago

maxfischer2781 commented 7 years ago

With separate Chains and Links, there is currently no way for a Link to signal an end of chain traversal. This makes filters impossible, and thus makes future loops questionable.

There are two situations for aborting the traversal of a chain:

maxfischer2781 commented 7 years ago

Now using a StopTraversal exception. Only downside is that n->1 and 1->1 generators cannot stop traversal.

There is still some unclear semantics for stopping inside a nested chain with return value.

maxfischer2781 commented 7 years ago

Current approach seems to work well enough in practice. Lack of generator/coroutine support is unfortunate, but class based approaches work well as replacements.

Stop+return in nested chains seems ambiguous either way. Staying with the current approach, which is the most efficient. Whether to advance or not can be influenced by putting later elements into the nested or enclosing chain.