Closed kevinresol closed 7 years ago
So decompose
is what is used to pull out the individual parts of a stream into an array. So a CompoundStream will push all its part into the array, and Empty stream will do nothing and any other stream pushes itself. It's to avoid having compound streams for compound streams of empty streams and such things: https://github.com/haxetink/tink_streams/blob/pure/src/tink/streams/Stream.hx#L478
Calling retain
bumps up an internal counter that can be decremented again by dissolving the returned CallbackLink
(there should probably be a better type for that). Once it goes back to 0, the stream's destroy method is called (which currently does nothing for all implementations).
I started working on it because I was worried that the immutability might trash memory, but it seems that is not the case. So I'm not sure we want to keep that anyway. Feel free to ignore it for now ;)
And I don't know what retain and decompose are.