[ccan] [PATCH] RFC: generator: Generators for C

David Gibson david at gibson.dropbear.id.au
Wed Jul 16 01:07:38 EST 2014


On Mon, Jul 14, 2014 at 08:21:10PM +0930, Paul 'Rusty' Russell wrote:
> David Gibson <david at gibson.dropbear.id.au> writes:
> > Yeah, yeah, I should finish one module before making another.  What
> > can I say, I like my Python generators and I was intrigued to see if I
> > could do it in C.
> >
> > This draft is very limited - generators can't take parameters and
> > always return ints.  I have some ideas on how to fix that, but for now
> > wanted to send this out for comment.  Frankly, I'm kind of stoked it
> > worked even this much.
> >
> > Generators are a limited for of co-routine, which people may be familiar
> > with from Python.  This module adds an implementation of generators for C.
> 
> This *is* very cool!
> 
> Using fibbonaci as an example would be more expressive, I believe,
> BTW.

Yeah, I was thinking about that.  The wrinkle is that the Fibonacci
series is infinite, of course, so it raises extra questions about
cleaning up a generator before completion.

Not that those don't need to be addressed anyway.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20140716/388fa926/attachment.sig>


More information about the ccan mailing list