Re: Proposal: Expanded iterable helper functions and aliasing iterator_to_array in `iterable\` namespace
| From: | Levi Morrison via internals | Date: | Fri, 28 Oct 2022 17:45:31 +0000 |
| Subject: | Re: Proposal: Expanded iterable helper functions and aliasing iterator_to_array in `iterable\` namespace | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118906@lists.php.net to get a copy of this message | ||
> > There's other functionality that I was less certain about proposing, such as
> >
iterable\keys(iterable $iterable): array,
> > which would work similarly to array_keys but also work on Traversables (e.g. to be used
> > with userland/internal collections, generators, etc.)
>
> I assume this doesn't care about key uniqueness -- it takes the keys
> and makes them values, in the same order they were returned?
>
> In any case, I don't think this should return an iterable, not array,
> to allow for lazy operations in a chain, while also allowing for using
> an array as an optimization.
Oops, I meant to say I think this should return an iterable, not an array.