From: "David A. Black" Date: 2005-10-14T22:16:30+09:00 Subject: Re: Default argument values for blocks Hi -- On Fri, 14 Oct 2005, Christian Neukirchen wrote: > "David A. Black" writes: > >> Hi -- >> >> On Fri, 14 Oct 2005, Gyoung-Yoon Noh wrote: >> >>> +1 >>> >>> collection.each : (foo="bar") { puts foo } >>> >>> It looks like 'when condition : expression' branch in >>> 'case' statement. >> >> But why would you want a method call and argument list and block to >> look like when condition : expression ? There's no "then" meaning to >> it. > > Read the : as "do". When x is one, do... For every item of the > collection, do... But it's such a stretch to look at it that way (and it's not the same "do" as the usual "do"). > I think the :(){} stuff is the nicest looking approach as of now, but > I wouldn't use it when ordinary {||} is enough. As I said previously, I think that if there's a block syntax with (), it should *not* have {}. There's simply no reason for {} at that point, and all it does is make the () feel like it's in the wrong place. I still just can't imagine having two ways to do all of this -- trying to explain it, reconcile it with other syntax, etc. It's bad enough that people debate things like using empty parens on method calls, or whether to omit "return".... The thought of people having to learn two block syntaxes, and choosing between them, and debating it (which *will* happen, at great length), all because of the stupid pipe character.... oy vey. Oh well, back to RubyConf preparation :-) David -- David A. Black dblack@wobblini.net