At 01:04 AM 12/15/2007 -0800, tomer filiba wrote:
>* do you suppose it will work? are there any drawbacks i didn't
Specifically, think about what happens when a C function is in the
call stack, e.g.:
return map(f2, [1,2,3])
If I understand you correctly, when this program is run, it will
print "1", rather than "[1, 2, 3]", because there is no way for you
to keep track of the internal state of the 'map()' call.
And this isn't just a problem for map() -- even something as simple
as a property access passes through C code whose state can get lost.
I don't think this approach is practical; you'd be better off using a
co-routine stack and trampoline, since the nature of generators
naturally forces all the C code out of the picture.