I was reading the official docs
Class: Proc (Ruby 2.1.0). Where
`lambda#arity` calculstion made me confused. Then from
ruby - Proc.arity vs Lambda.arity - Stack Overflow I
got some clue that `lambda#arity` always one complements of `Proc#arity`
?
Code :
(arup~>~)$ pry --simple-prompt
proc { |(x, y), z=0| }.arity
=> 1
lambda { |(x, y), z=0| }.arity
=> -2
proc { |x=0, y=0| }.arity
=> 0
lambda { |x=0, y=0| }.arity
=> -1
Now my direct question is - Why lambda#arity always one complements of
Proc#arity ?
But one example again made my all assumptions are less confident about
`lambda#arity` calculation. See below :
proc {}.arity
=> 0
lambda {}.arity
=> 0
Where does here `lambda#arity` not one complements of Proc#arity ?
···
--
Posted via http://www.ruby-forum.com/\.