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)

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.

Any other thoughts or interpretations of this behavior?


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav