From: Trans Date: 2005-10-12T15:46:53+09:00 Subject: Re: Default argument values for blocks Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Default argument values for blocks" > on Wed, 12 Oct 2005 02:25:33 +0900, Yukihiro Matsumoto writes: > > ||Is there a reason why I can't do this? > || > || foo = lambda { |foo = bar| puts foo } > || foo.call > || > ||I can't think of any good reason why this isn't valid. > | > |Mostly because yacc does not allow it. It confuses > | > | lambda { |foo = bar| puts foo } > | > |as > | > | lambda { |foo = (bar| puts foo) } > | > |and causes syntax error. > > For your information, you can do > > foo = ->(foo="bar"){puts foo} > foo.call What of &? a.each( &->(foo="bar"){puts foo} ) # Ick. Can we drop? a.each( ->(foo="bar"){puts foo} ) # Better. T.