That First Next Argument

Kevin Smith zenparsing at gmail.com
Mon Aug 18 21:47:54 PDT 2014


Background:

http://esdiscuss.org/topic/next-yo-in-newborn-generators
http://esdiscuss.org/topic/april-8-2014-meeting-notes

It appears that the current state of affairs is that the argument supplied
to the first call of `next` on a newborn generator is "ignored and
inaccessibe".

Clearly, this means that there are some iterators which cannot be expressed
as a generator (namely, any iterator that echoes back it's `next`
arguments).  It seems like there should be parity here.

More concretely, the fact that information can be passed into generators
means that they can be used to create data sinks.  Since that first input
is inaccessible, however, this use case is made more awkward than it needs
to be; the consumer has to artificially "pump" the generator to get past
that first (useless) `next`.

Is there any way that the generator function can have access to that lost
data?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140819/749f06d8/attachment.html>


More information about the es-discuss mailing list