From: Robert Dober Date: 2007-06-13T17:38:03+09:00 Subject: Re: a matter of style On 6/12/07, Chad Perrin wrote: > > That's going to depend partly on whether you run across the > > (relatively rare) case where the precedence difference between {} and > > do/end actually matters. There are also some interesting ideas on > > record (see archives) involving blocks with side effects vs. blocks > > that just calculate. But I can't remember which is supposed to be > > which :-) > > I have yet to see a practical case where the precedence actually came > into play -- and I suspect that, when I do finally see such a thing, > readability would benefit from a refactor so that it doesn't come into > play after all. Depends a lot of your style: In my DSL I use at work I will write stuff like client :name => "allow ssh to DB", :server => "1.1.1.1" ... do end If you leave the parens away the {} just will not work, so this for sure is a nice feature for a DSL. That does not necessarily make it the best "Programming Style". Personally and sorry for insisting just find hat def recover parms = {}, &blk ... recover :from => :error do some_stuff end ... reads better (for me) than def recover( params ={}, &blk) ... recover( :from => :error ){ do_some_stuff } I dislike parens, but I am pretty alone, so I gotto refrain from repeating myself (still hoping for some support here, obviously ;) Cheers Robert > -- > CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] > Ben Franklin: "As we enjoy great Advantages from the Inventions of others > we should be glad of an Opportunity to serve others by any Invention of > ours, and this we should do freely and generously." How right he was. -- If he really said that > > -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw