I tried to understand how Ruby blocks work, and for that I tried to implement them in C.
One easy way to implement closures is to pass void* to the enclosing stack for a closure / function, but Ruby blocks also handle return and break commands from the scope using that block.
loop do break i if (i >= 4000) i *= 2 end
I think one of the closure sentences for Java works the same way.
So, how would you implement Ruby blocks / Java closures in C?
java c ruby
Julio CΓ©sar
source share