Re: [Pre-RFC] Lazy iterator_* functions for iterables

From: Date: Sun, 22 Nov 2026 20:30:11 +0000
Subject: Re: [Pre-RFC] Lazy iterator_* functions for iterables
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-133189@lists.php.net to get a copy of this message
On 2026-11-23 00:26, Paweł Wankiewicz wrote:
Hi internals, I propose adding 11 functions that mirror existing array_* functions and pass the exact same arguments to their callbacks: - Lazy (returning an Iterator): iterator_map, iterator_filter,   iterator_slice, iterator_keys, iterator_values - Terminal (returning a value): iterator_reduce, iterator_any, iterator_all,   iterator_find, iterator_find_key, iterator_first I like the sound of this (having written my own userland iterator library to do these things and a bunch that you defer to later RFCs). From your mention of iterator_to_array and iterator_count I take it these new functions would take any iterable as argument (specifically: pass them an array directly, instead of wrapping it in an ArrayIterator first)?


« previous php.internals (#133189) next »