-
Notifications
You must be signed in to change notification settings - Fork 9
Description
As discussed in TuringLang/Turing.jl#1237, it would be nice to implement the iteration interface for CTask since then it would be possible to use alternatives such as resumable functions in the particle filter implementations in Turing in a straightforward way (currently produce and consume statements are hardcoded). However, currently CTask is just a function that returns a Task for which stack copying has been enabled. Implementing the iteration interface for Task would be pretty bad type piracy (BTW Base.copy(::Task) in the current code is also type piracy). To avoid this I suggest adding a CTask struct that is defined as
struct CTask
task::Task
endThen Base.copy and Base.iterate could be implemented without committing type piracy. The downside would be that one would probably have to forward a bunch of methods defined for Task (such istaskstarted etc.) to task.
Do you think I should give it a try, or are there any other suggestions?