Re: Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)
| From: | Levi Morrison via internals | Date: | Thu, 10 Jun 2021 15:54:14 +0000 |
| Subject: | Re: Re: RFC: CachedIterable (rewindable, allows any key&repeating keys) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114819@lists.php.net to get a copy of this message | ||
On Thu, Jun 10, 2021 at 8:40 AM Pierre <pierre-php@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.