Re: Allow Iterator to be used with current, next, reset,key functions
| From: | Christoph M. Becker | Date: | Mon, 31 Oct 2016 18:17:53 +0000 |
| Subject: | Re: Allow Iterator to be used with current, next, reset,key functions | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96683@lists.php.net to get a copy of this message | ||
On 31.10.2016 at 18:27m Larry Garfield wrote:
> On 10/31/2016 11:26 AM, Alice Wonder wrote:
>
>> On 10/30/2016 10:19 AM, Rowan Collins wrote:
>>
>>> - deprecate reset(), end(), each(), and key()
>>> - introduce array_first(), array_last(), array_first_key() and
>>> array_last_key()
>>> - document replacements for whatever other use cases we can find
>>> examples of
>>
>> As a user I certainly like those names better. Semantic function names
>> are a definite win in my view.
>
> Question: Now that we have "iterable" as a type, should we be adding
> more array-specific functions or should such operations be designed, and
> named, to operate on any iterable? (first(), first_key(), etc.)
According to the earlier discussion it is not clear if we want these
functions to operate on Iterables (consider Generators). Anyhow, we
probably can't introduce a function named first() for BC reasons.
--
Christoph M. Becker