Closed Smoren closed 1 year ago
Hi @Smoren,
Thank you for the feature suggestion. Give me some time to think about this and I'll get back to you. Sorry to make you wait.
Thanks for understanding. Mark
@markrogoyski
Thank you for the answer.
I will wait for your decision.
Hi @markrogoyski,
I thought about the renaming of Stream
namespace and I have a very simple idea.
Maybe Iterable
or IterableWrapper
?
Iterable::of($smth)
->pairwise()
->toArray();
I think it looks nice :)
Hi @Smoren,
Thanks for your suggestion and continued interest to improve IterTools. I have not released a new version that has the Streams feature yet, so it is still possible to make changes.
However, I would argue that Stream is right name for this for three reasons.
1) The word "stream" gives the image of things flowing together continuously, like the fluent chaining of methods together. Since the stream repeatedly processes the data, it is a form of iteration, and fits in with the theme of IterTools.
2) This is a common name for this functionality. See Java Streams, C++ Streams API, numerous python stream libraries (streams, python-stream, streampy, Streams, python-streams, python-streaming , pyStream, pystreams), etc.
3) It differentiates it clearly from the looping constructs in the library. IterTools now provides tools to power loops, and tools to process iterables in a functional pipeline, consisting of a source, zero-or-more operations, and a terminal operation.
These are my reasons. I'm happy to continue to discuss if you like. Thanks. Mark
Hi @markrogoyski,
Your arguments sound persuasive. I no longer insist on renaming. Have you decided anything about including resources in IterTools?
Hi @Smoren,
I think resources is too big a topic. See here: https://www.php.net/manual/en/resource.php. Many things return resources, including network calls and protocols, database handles, etc.
Maybe narrow the scope to iterating files or something would help refine the idea and make it workable. I can immediately think of iterating lines of a file, and lines of a CSV. Anything else you would consider? And maybe the namespace is File
rather than Resource
to clearly indicate the intent?
Thanks, Mark
Hi @markrogoyski,
I think namespace File
is a good idea. I'll think about it's methods and their implementation.
Hi Mark!
What do you think about the functionality for iterating resources in IterTools? For example, reading files. Something like this:
BTW, this may confuse the
Stream
namespace. What do you think, maybe renameStream
toFluent
or something else?