On Friday, 21 February 2003 at  1:19:17 +0900, dblack / candle.superlink.net wrote:
> Hi --
> 
> Arising from a recent discussion on #ruby-lang:
> 
> Proc objects created by Method#to_proc seem to care about their arity
> in a way that other Proc objects don't.  To illustrate:
> 
>   class A
>     def talk
>       puts "hi from A#talk"
>     end
>   end
> 
>   pr = Proc.new { puts "hi from anonymous Proc" }
>   methproc = A.new.method(:talk).to_proc
> 
>   [1,2,3].each &pr         # "hi from anonymous Proc\n" * 3
>   [1,2,3].each &methproc   # in `talk': wrong # of arguments(1 for 0)

Interesting. I would have just done

  [1,2,3].each { methproc.call }

and never have noticed. Can you explain what is happening when
I replace {...} with &pr.
 
> The #to_proc proc is reacting like a method, not a proc, when given
> the "wrong" number of arguments.  For me, this doesn't fit in with the
> idea of (complete) conversion to a proc.
 

-- 
Jim Freeze
----------
If God had intended Man to Walk, He would have given him Feet.