On 12/19/05, gwtmp01 / mac.com <gwtmp01 / mac.com> wrote: > > On Dec 19, 2005, at 4:19 PM, Jacob Fugal wrote: > > [5] You can change a Proc object into a block with the & prefix. (In > > fact, you can turn any object into a block with & and a properly > > defined to_proc method. Whether doing so is good practice is > > debatable.) > > This doesn't seem quite accurate to me. The expression generated > by the use of '&' in a method call is an instance of Proc. If the > expression prefixed by '&' is already an instance of Proc then > no conversion of any type occurs, the object is passed 'as is' to > the method. > > If might be more accurate to say: > > Instead of using a literal block in a method call, you can arrange > for any object to be passed as the 'block argument' to the method > with the '&' prefix operator: > > method(arg1, arg2, arg3, &block_arg) > > If 'block_arg' is not an instance of Proc, then block_arg.to_proc > is called and the result, which must be an instance of Proc, is > passed to the method instead. That's very true and accurate. Thanks for the clarification. My original intent was to say "You can [pass] a Proc object into a block [argument] with the & prefix." The type of the object doesn't change, just the passing semantics. And, "In fact, you can turn any object into a [Proc with block argument semantics] with & and a properly defined to_proc method." Careless terminology and lack of proofreading, my apologies. Jacob Fugal