From: Mikael Brockman Date: 2004-08-19T23:31:08+09:00 Subject: Re: When to use parentheses around method args? Richard Dale writes: > Martin DeMello wrote: > > > George Ogata wrote: > >> Richard Dale writes: > >> > >> > Are there any rules of thumb for when it's a good idea to leave out the > >> > brackets and when to use them? > >> > >> I don't think there are "rules of thumb" for definitions, but assuming > >> you have a newline after the args (i.e., you're not squashing a whole > >> def...end on one line or something), parens on def-lines are _always_ > >> redundant, thus I _never_ use them. Perhaps it's just Emacs' syntax > >> highlighting, but I find it perfectly clear, even for operator-defs > >> like "def << x". > > > > Whereas I always use them for defs, since it fits my perception of x as > > a placeholding parameter rather than a value. > That's what I've done so far, but I might try Mikael's suggestion: > > Mikael Brockman wrote: > > In method definitions, I use parens unless there's only one argument. > > In method calls, I use parens when I need to, or when omitting them > > looks weird. Er, not that it really matters, but I meant to say ``unless the argument list is empty.'' mikael