[PHP-DEV] Re: Support rewinding of generators

2020-03-01 Thread Andrea Faulds
Hi again, Andrea Faulds wrote: I am not sure if I think this is a good idea… for one thing it may not be necessary to add support in core for this, because you could easily write a userland Iterator class that wraps a generator-returning closure and (re-)invokes it for you. If you do it yourse

[PHP-DEV] Re: Support rewinding of generators

2020-03-01 Thread Andrea Faulds
Hi, Nikita Popov wrote: There is a relatively simple (at least conceptually) way to make generators rewindable: Remember the original arguments of the function, and basically "re-invoke" it on rewind(). I'm wondering what people think about adding this functionality. I think the main argument a