Open kostya opened 8 years ago
Yes, this is a known limitation.
I think I'd like the language to support built-in forwarding to another member, similar to how in Go you can "include" another type inside a type and the compiler would check methods in this another type if it can't find them in the current type. This will solve probably 99% of the use cases of method_missing
.
sometimes need not only forwarding, but also little processing, rescuing
Then I think this will be solved once we allow yield
to be used when a block is captured. But if that happens, it will happen much, much later as it's pretty complex to implement right now.
Meet this problem again. Now i think, why not possible just pass block as it is (as text) in method_missing (add method source for example)? Usage of method_missing is proxying methods.
class A
macro method_missing(call)
@b.prefix_{{call.name}} { {{call.block.source}} }
end
end
and it would add original block here, instead adding this:
do |_block_arg0|
yield _block_arg0
end
oh, nvm, it would change binding.