hydroflow
hydroflow copied to clipboard
extended semantics for `defer_signal`
Based on #966
Two independent considerations here:
- Do we empty the buffer on new
input? - Do we empty the buffer on new
signal?
The current implementation is {input: no, signal: yes}: in a tick when data arrives on the [input] port, append the new data to the contents of the buffer. On [signal], stream out a copy of whatever data is in the buffer and empty the buffer.
Three more possibilities:
{input: yes, signal: no}: in a tick when data arrives on the [input] port, replace the contents of the buffer with the new data from [input] in this tick. On [signal], stream out a copy of whatever data is in the buffer.
{input: no, signal: no}: in a tick when data arrives on the [input] port, append the contents of the buffer with the new data from [input] in this tick. On [signal], stream out whatever data is in the buffer. This is equivalent to cross_join::<'static, 'tick>.
{input: yes, signal: yes}: only produce output if the [input] and [signal] ports both have data in the current tick, producing only the [input] that arrived in this tick. This is equivalent to cross_join::<'tick, 'tick>.
Note that the first two choices replace the buffer in ways that are not equivalent to a join.
Related #1373