From: Austin Ziegler Date: 2005-10-14T23:15:43+09:00 Subject: Re: Default argument values for blocks On 10/13/05, Eric Mahurin wrote: > --- Austin Ziegler wrote: > > foo = lambda { |foo = 1 | 2| puts foo } > How do you interpret the above? > > foo = lambda { |foo = 1| (2|puts foo) } > > or > > foo = lambda { |foo = (1|2)| puts foo } The first isn't a reasonable interpretation. (Why? Execute it mentally; we "puts foo", and puts returns +nil+; 2 | nil is a TypeError.) The second is by far the bettter interpretation -- and it's a lot cleaner than ->(foo = 1 | 2) { puts foo } will *ever* be. I'd much rather put up with a performance hit than that .... trainwreck in Ruby. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca