From: Guillaume Cottenceau Date: 2001-03-06T23:08:56+09:00 Subject: [ruby-talk:12134] Re: Proc.arity() broken on Windows? Mike Bowler writes: > When I run the following code on windows and on linux, I get different > results. > > def testArity( &proc ) > puts proc.arity() > end > > testArity() {} > testArity() { |a| } > testArity() { |a,b| } > testArity() { |a,b,c| } > > On linux, the result is: > -1 > -2 > 2 > 3 > > On windows, the result is: > -1 > -1 > 2 > 3 > > This means that on windows there seems to be no way to distinguish > between no parameters and one parameter. Actually, a block with exactly no parameter, and exactly one paramter, will look like that: testArity() { || } testArity() { |a,| } About the behaviour, I think the Windows behaviour is the old Ruby behaviour (reported in the Ruby Pragmatic Programmers book if I remind it well) and the Linux behaviour is the recent one. -- Guillaume Cottenceau - http://us.mandrakesoft.com/~gc/