A question about the flow specification (https://github.com/leonoel/flow):
I notice that (m/ap (throw (Error. "oops"))) first calls terminator and then throws the exception from deref.
m/reduce appears to rely on this behavior. (In Clojure at least, I haven't tried it with the ClojureScript implementation). If m/reduce is called on an input flow which throws from deref without calling terminator, the task returned by m/reduce doesn't call its failure continuation.
Should this be part of the spec, that if the producer throws an exception from deref to indicate a failure, the producer should also call terminator?
The spec for the terminator says > It is called exactly once by the producer when the process instance has no more values to transfer and all of its resources have been released The spec for transfer says > It may throw an exception to indicate a failure, in this case it must not call the notifier again So if a transfer throws, the process is done. It must do all cleanup work at this point and call the terminator.