Re: Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)

From: Date: Sat, 12 Jun 2021 15:20:05 +0000
Subject: Re: Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-114834@lists.php.net to get a copy of this message
Hi internals, > > > 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. > > 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. I think CachedAggregate would have problems with an unclear meaning similar to those that were raised previously in https://externals.io/message/114819#114798 (Some developers would think it may refer to the act of lazily evaluating the iterable(caching it on-demand to access later)) https://en.wikipedia.org/wiki/Aggregate on its own refers to a collection of objects/values or in other contexts, functions such as count/sum/min/max https://en.wikipedia.org/wiki/Aggregate_function - In other contexts such as set theory, there might not be keys associated with the values so aggregate on its own seems unclear. ImmutableIteratorAggregate or just ImmutableIterable/ImmutableTraversable makes more sense than Cached* to me. ImmutableKeyValueSequence is an even shorter name than ImmutableIteratorAggregate and describes what the data structure is. Thanks, Tysosn

« previous php.internals (#114834) next »