On Thu, Jun 10, 2021 at 8:40 AM Pierre <pierre-...@processus.org> wrote: > > Le 10/06/2021 à 16:16, tyson andre a écrit : > > So I'm probably changing this to `ImmutableTraversable` as a short name for > > the functionality, > > to make it clear arguments are eagerly evaluated when it is created. > > (ImmutableSequence may be expected to only contain values, and would be > > confused with the ds PECL's > > https://www.php.net/manual/en/class.ds-sequence.php) > > Hello, > > And why not simply RewindableIterator ? Isn't it the prominent feature > of it ? > > Agreed it's immutable, but a lot of traversable could be as well. > > Regards, > > -- > > Pierre > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >
All iterators are "rewindable", though of course not in practice. I would avoid such names because we may eventually add an interface which works as a "tag" to say "yes, I actually do support rewinding." The property of being rewindable comes from it being cached. Maybe `CachedAggregate`? Aggregates are data structures from which an external iterator can be obtained, so it makes a bit more sense if it's eager. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php