Open MarkNahabedian opened 1 week ago
Thanks for reporting this, it is indeed a bug within ResumableFunctions that we should fix.
Currently I am a bit uncomfortable with the proposed solution. It would indeed make intersect
work, but there are probably other methods on iterables that will continue failing. I hope there is a solution where we can just make the default intersect
implementation work (so that we do not play whack-a-mole every time there is a new function to worry about). After all, the default collect
works fine.
Which is also a quick workaround until this is fixed:
intersect(collect(resumable_f), some_other_iterator)
Though Base.union works with the iterators produced by @resumable, Base.intersect does not:
The below suggestion is untested.
First we need a common supertype for all resumable functions:
The
@resumable
macro would need to be modified such that the struct it defines inherits from that supertype.Then, something like
This doesn't quite adhere to the documentation for
Base.intersect
, which says that the result should be of the same type as the first argument. If the first argument is an iterator then presumably returning an iterable is sufficient. In any case, its an improvement overBase.intersect
not workiing if the first argument is a ResumableFunctions iterator.