From: dblack@... Date: 2007-06-13T20:55:54+09:00 Subject: Re: a matter of style Hi -- On Wed, 13 Jun 2007, Robert Dober wrote: > 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 ;) It's not a contest -- not even a debate. Ultimately people should do what they want. I like to steer people, especially newcomers, to the traditional style, in the hope that that's what they will decide they want to do, partly just because it *is* the traditional style, and partly because on the whole it looks so great. That's all there is to it. You already know everything you need to know, and you can decide what to do. It doesn't matter who (including me) says what (and we already have ways to determine what Matz does). In other words, let's not get into one of these interminable threads where people try to "argue" and "convince" each other. It's just not that kind of situation. (And neither are 99.9999% of such threads :-) David -- * Books: RAILS ROUTING (new! http://safari.awprofessional.com/9780321509246) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)