Streaming and iterating

During my usual thoughts about the current modules I'm working on, I've come to a kind of stunning conclusion. First of all, I generalized number parsing into a single function using a settings structure, so that some additional ones can craft a binary value of it. I wondered whether it'd be useful to only accept null-terminated strings as input and couldn't decide whether to do this or made it to some kind of streaming function, returning the first non-number position in the string. And well, this made me realize that it'd be much better to provide a set of in/out streaming string functions instead of lame, limited one. Sure, this takes a lot more infrastructure, but is extremely compact in footprint and provides a very simple interface. So I took it further and made a concept of a streaming system that provides an interface-based access to whatever logic is behind the streaming. And that is where the conclusion kicked in: What would happen, if I extend the stream to also provide positioning? How can one decide what address model it takes for the stuff behind? Can't I also realize fifo and lifo stacks as well as arrays and other types with it? So my conclusion is that streaming itself is only a slightly different logic compared to iterators, only that they provide a specialized interface for it. Sure, I had was the possibility to add this, too. But I still believe it's not a good idea to use iterators for a generalization of lists, arrays and the like. So I sticked with a more limited concept of having a memory streamer, a file streamer and lisstreamer, building an abstract stream out of multiple ones. I can't think of any other idea right now, but I guess I don't need something else for this. A stream is not a list or hash array or whatever. It's thought as binary flow, having whatever data in which's is formed to elements when it's read. Totally different to iterator-supported storages which are made of distinct elements of size irrelevant for the iterator user. But it's still creepy how connected all those generalized data storage interfaces are. I'm sure one day someone will start to merge them all. The day when certain things don't matter anymore.

No comments: