Hi John, On Nov 23, 2009, at 1:03 AM, John Shea wrote:
I imagine that it is actually quite hard to turn ruby blocks into C blocks - normally everything would be copied to the stack with C blocks - unless manually copied to the heap - but probably in macruby they have to be immediately copied to the heap. And then what to do with all the scoped (but in C static) variables? In C there are complicated inferred return block types which sometimes work, automatic releases sometimes, sometimes manual releases are necessary of queues (i.e GCD does not use GC) - it all seems rather complicated.
Did you mean the other way around? You seem to be discussing how to turn C blocks into Ruby blocks. Regardless, if you look at the GCD code you'll see that he sidesteps the issue, by passing the ruby block as a context pointer to a gcd_f function-based API. -- Ernie P.