On 29 January 2018 19:14:43 GMT+00:00, Michael Morris <tendo...@gmail.com> wrote: > The is_callable() >above prevents iteration over generators, potentially consuming them >for no purpose.
Unfortunately, it doesn't: it's not the generator definition that you'll be passed, but the Generator object returned when you run it, and that is not callable https://3v4l.org/rknQJ (The definition is more like a constructor, and I wish it didn't look so much like a normal function in declaration and use.) Nor are generators the only non-rewindable iterables you need to worry about, so really the only options you have are to only inspect arrays, or to add a big fat warning that the function may consume your iterable (or enter an infinite loop). Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php