From: David Alan Black Date: 2004-05-02T19:34:03+09:00 Subject: Re: {} VS do/end styles Hi -- Jean-Hugues ROBERT writes: > At 15:12 02/05/2004 +0900, you wrote: > > > > * do/end is *easier* to type than {} in terms of wear and tear on > > > > my poor fingers > > > > > > > > > Ok, well how 'bout this: braces use fewer characters, so you save disk > > > space. > > > > > > >Whether do/end is easier to type than {} is rather subjective... from > >personal experience, I tend towards {} because I can type {} in an > >easy stroke (hold down shift, roll fingers over { and }), and I can > >then fill in. But I digress - I'm just talking of personal experience. > > > >To tackle the answer from a different angle - my guess is that > >programmers who come from a C/Java/Perl environment would lean towards > >{}, and programmers from a shell scripting environment may tend > >towards do/end, simply because of habit. > > I come from Pascal, so I tend to do/end. So you are probably right > about the habit. I come from Ruby :-) and I find myself tending to use {} for shorter blocks and/or blocks that are chained: a.select {blah}.map {blah} # etc. partly because "do blah end.map do blah end" sort of runs together visually. My instinct was always to space the dots apart in such cases: a.select {blah} .map {blah} though I've recently noticed that this isn't done in the Ruby distribution, which I generally use as my style reference. > The sad thing is that this style issue really matters a lot for people. > As a result rejecting either option is religious and accepting both is > agnostic. Once again religion leads to war. Really sad. Heavens. I think we were just chatting about it. Here on ruby-talk/clr we still do that sometimes :-) David -- David A. Black dblack@wobblini.net