haxetink / tink_streams

Streams from the future. With lasers, of course ... whoaaaaa!!!!
The Unlicense
12 stars 9 forks source link

You realize StreamStep and ParseStep are the same datatype, right? #2

Closed 0b1kn00b closed 7 years ago

0b1kn00b commented 8 years ago
enum ParseStep<Result> {
  Failed(e:Error);
  Done(r:Result);
  Progressed;
}

enum StreamStep<T> {
  Data(data:T);
  End;
  Fail(e:Error);
}
0b1kn00b commented 8 years ago

general Chunk datatype

back2dos commented 8 years ago

They are quite different. A stream progresses with data and ends with nothing, while a parser progresses with nothing and ends with data.

Generally I found that streams of bytes and streams of actual data should not be treated the same, which is why I consider tink.streams.Stream and tink.io.Source to be fundamentally different. One could express the latter through the former, but my attempts to do that resulted in abysmal performance. I also found the generalization yielded little practical value. IO streams need to be parsed, chunked or piped. Data streams need to be filtered, mapped, aggregated, merged etc.

back2dos commented 7 years ago

Closing for now since the debate seems to have come to a halt ;)