From: Vitor Peres Date: 2007-12-06T04:25:23+09:00 Subject: Re: Keeping variables across requires? ------=_Part_2376_3884562.1196882722098 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Dec 5, 2007 5:13 PM, Peter Bunyan wrote: > Ah, thanks. With Ruby I'm used to not having to do global/local things; > I didn't know you could create global ones with $. But now I have > another problem: The functions I created with lambda {} are now > returning -1 as their arity. > AFAIK, that's a quirk in 1.8. Blocks with no arguments return -1 when you ask them for their arity. That behavior was redefined in 1.9, and they now return 0. You can also, currently, pass arguments to those blocks without any indication that they'll be ignored. 1.8.6: irb(main):001:0> lambda {}.arity => -1 irb(main):002:0> lambda {}.call 1 => nil 1.9.0 (2007-11-28 patchlevel 0): irb(main):001:0> lambda {}.arity => 0 irb(main):002:0> lambda {}.call 1 ArgumentError: wrong number of arguments (1 for 0) -Vitor. ------=_Part_2376_3884562.1196882722098--