On Sat, Jul 1, 2017 at 1:38 PM, Andreas Hennings <andr...@dqxtech.net> wrote: > Hello internals, > (this is my first email to this list, hopefully I'm doing ok.) > Welcome to php-internals!
> Establish a new interface in core, "Reader" or "ReaderInterface" (*). > This interface has only one method, "->read()". > The existing interface Iterator will remain unchanged. > Rather than introduce a new kind of iteration mechanism, how about just creating a library in userspace which provides a proxy interface: class Reader implements Iterator { protected $it; public function __construct(iterable $it) { $this->it = $it; } public function current/key/next/rewind/valid() { $this->it->current/key/next/rewind/valid(); } public function read() { /* What a reader should be */ } } Then you can use any already extant iterable via: $reader = new Reader($iterable); This could live in a composer/packagist library and work on already released versions of PHP. Or is there something I'm missing? -Sara -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php