David A. Black wrote:
>> Are there any rules of thumb for when it's a good idea to leave out the
>> brackets and when to use them?
> 
> Personally I like to adhere as much as possible to the style
> established by Matz and the other core developers, though I know this
> attitude has lost popularity in recent years.  Anyway, if you want to
> be a conformist sheep like me, you can use the Ruby distribution as
> a source of information about coding style:
> 
> # These are almost certainly not 100% correct counts, but they give
> # you a very good indication of standard practice.  This is
> # Ruby 1.8.1.
> 
> # All def's:
> 
> $ grep "^[[:space:]]*def" `find . -name "*.rb"` | wc -l
>    7484
> 
> # All the def's with no parentheses:
> 
> $ grep "^[[:space:]]*def " `find . -name "*.rb"` | cut -d# -f1 |\
>   grep -v "(" | wc -l
>    2438
> 
> # All of the above which have more than one word other than "def"
> # (filtering out one-line defs):
> 
> $ grep "^[[:space:]]*def" `find . -name "*.rb"` | cut -d# -f1 | \
>   grep -v "(" | grep -v "end$"| ruby -ne "print if split.size > 3" | wc -l
>     160
> 
> So about 94% of all def's with arguments in the Ruby distribution use
> parentheses.
> 
> You'll find similar stats for camelCase method/variable names,
> indentation by more than two spaces, and other points of style where
> Ruby will accept non-conventional practice but conventions and
> traditions do exist.  How you deal with these things is up to you.

"Anyway, if you want to be a conformist sheep like me.." - i

Indeed yes I do - whatever is the most socially acceptable and used by
acknowledged experts. It looks like brackets are in.

Your approach is very nice - quoting ruby code that allows you to query ruby
core developer's style programatically. I suppose you could knock up a
Rails site in a few (10?) mins that would allow visual tracking of the
changes to the core developer's style preferences in real time..

-- Richard