From: Gavin Sinclair Date: 2004-10-04T23:12:04+09:00 Subject: Re: Too Many Ways? On Tuesday, October 5, 2004, 12:08:42 AM, trans. wrote: >> So in an ideal world I'd have >> >> def foo(a,b) # block forbidden, raise exception if you pass one >> def foo(a,b,&c) # block required, raise exception if it's missing >> def foo(a,b,&c=nil) # block optional >> >> That syntax would also allow a 'default block': >> >> def foo(a,b,&c=proc{|x| $stderr.puts x}) > This last should be allowed anyway, me thinks too. That's bad style, IMO. I'd prefer to read this: def foo(a, b, &c=nil) c ||= lambda { |x| ... } ... end Gavin