Closed kevinresol closed 7 years ago
I'm fine with it. My suggestion would be to call asStream
differently, as the current name implies a sort of "cast" or something, when really it creates a new stream - as opposed to SignalTrigger.asSignal that always gives you back the same signal. But I'll let you be the judge of that ;)
If you don't mind letting go Accumulator I can simply remove it and promote using SignalStream
Sounds like a plan.
Yay!
I think that the main objective of an Accumulator is for manually yielding results, and it does the job. But currently the implementation has a downside that (if I understand correctly) it holds the stream "root", meaning that for long-running streams like a tcp connection, the "whole history" will be held in memory until the accumulator reference is let go. Here I suggest implementing Accumulator over a Signal(Trigger), so that the user only holds the reference to the trigger, thus allowing the stream history to be garbage collected.
As a result, there will be both an API and behavior change:
before:
now: