Yes, I think this is a mistake.
I think it comes down to curry returning a "C-level proc" rather than a regular proc. I donβt quite understand the difference between the two (I assume that the first is the code generated by the Ruby C code, which is curry ), but you can say that they are different when you try to take a binding.
p.binding
Looking at the source , it looks like their internal representations of the structure have different meanings for the iseq member, which says that this sequence of commands is preserved.
This is important when you call instance_exec , which ultimately calls invoke_block_from_c in vm.c , which leads to iseq type:
else if (BUILTIN_TYPE(block->iseq) != T_NODE) { ... } else { return vm_yield_with_cfunc(th, block, self, argc, argv, blockptr); }
A disconnected branch ( ... ) ends with a call to vm_push_frame , which looks like an environment where vm_yield_with_cfunc does not work.
So, I assume that since curry proc is created in C code and ends with a different βtypeβ than your first proc, another branch is taken in the above snippet and the environment is not used.
I must point out that all this is rather speculative, based on reading the code, I did not run any tests or tried anything (and I am also not so familiar with internal Ruby!)
simonwo
source share