Based on Robert's code, isn't this false, with it being a feature of super
and not send?
···
On Sun, Mar 13, 2011 at 11:40 PM, Aaron D. Gifford <astounding@gmail.com>wrote:
I agree that the documentation the original post linked to really
should mention that if any block is passed to send, the block is
passed on to the method invoked.
I agree that the documentation the original post linked to really
should mention that if any block is passed to send, the block is
passed on to the method invoked.
Based on Robert's code, isn't this false, with it being a feature of super
and not send?
No. Robert's code with super certainly demonstrated that super will propagate a block but that is entirely beside the point because send doesn't use super to invoke the named method. I really don't understand why Robert said:
Automatic propagation of the block is not a feature of #send but a feature of "super":
Internally #send is written to propagate any block to the named method and that should be documented.
Gary Wright
···
On Mar 13, 2011, at 8:00 PM, Adam Prescott wrote:
On Sun, Mar 13, 2011 at 11:40 PM, Aaron D. Gifford <astounding@gmail.com>wrote:
I agree that the documentation the original post linked to really
should mention that if any block is passed to send, the block is
passed on to the method invoked.
Based on Robert's code, isn't this false, with it being a feature of super
and not send?
No. Robert's code with super certainly demonstrated that super will propagate a block but that is entirely beside the point because send doesn't use super to invoke the named method. I really don't understand why Robert said:
Automatic propagation of the block is not a feature of #send but a feature of "super":
My point was, that _automatic_ propagation (i.e. propagation without
the user needing to do something) is only done by "super" (please see
the example). All other delegating mechanisms (i.e. directly calling
a method, invoking #send) do need to explicit propagate the block.
And #send likely does so internally as well - although I tend to view
#send less as a method but rather as a language feature of Ruby's
reflection capabilities.
Internally #send is written to propagate any block to the named method and that should be documented.
Yes, of course. Method #send without block propagation would render
it pretty much useless since any method in Ruby can use a block.
Kind regards
robert
···
On Mon, Mar 14, 2011 at 1:27 AM, Gary Wright <gwtmp01@mac.com> wrote:
On Mar 13, 2011, at 8:00 PM, Adam Prescott wrote:
On Sun, Mar 13, 2011 at 11:40 PM, Aaron D. Gifford <astounding@gmail.com>wrote:
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/