Re: Re: [RFC][Vote] iterable_to_array() and iterable_count()

From: Date: Thu, 05 Jul 2018 20:44:26 +0000
Subject: Re: Re: [RFC][Vote] iterable_to_array() and iterable_count()
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-102618@lists.php.net to get a copy of this message
2018-07-05 16:43 GMT+02:00 Jordi Boggiano <j.boggiano@seld.be>: > Just to explain the No vote for iterable_count, I think we'd rather advocate > people implement Countable in their iterables than to force the consumption > of an iterator just to count it as this can have side-effects and render the > iterator unusable. If Countable is implemented then count() will do the job > and all is well. If consuming the iterator is desired then one still can do > count(iterable_to_array($iter)) fairly easily. Hi, I absolutely agree. I initially started writing the RFC without iterable_count(), but later I decided to include it for completeness, so that both iterator_*() functions have a proposed alternative. Of course, and for the reasons mentioned I made a vote for each of them separately. M.

« previous php.internals (#102618) next »