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

Rusty Russell rusty at rustcorp.com.au
Mon Jul 14 20:51:10 EST 2014


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.

As you say, there's some polish remaining.  I look forward to args and
pointer returns :)

Cheers,
Rusty.


More information about the ccan mailing list