From: Thomas Adam Date: 2006-09-22T00:05:57+09:00 Subject: Re: the point of omitting parentheses On Thu, 21 Sep 2006 23:52:03 +0900 "Wilson Bilkovich" wrote: > On 9/21/06, devdev wrote: > > The point of being able to omit parentheses is to make it easier to > > write Domain Specific Languages (DSLs).The lack of parentheses > > makes it easier to create DLSs that consist of declared syntaxes or > > grammars, but have the DSL itself still be pure Ruby. Also by > > parentheses being optional, we can create a DSL for Ruby itself, in > > effect creating constructs which look and act like reserve word > > extensions to Ruby. > > I would say that that's this year's 'point'. For me, I just think > that they are ugly. > > I only use them in two places, personally: > 1. When the left-hand side of a ternary starts to look scary: > x = (foo == baz.something) ? this : the_other > > 2. Method definitions, since I find they draw the eye better than > without. def thingy x, y, *z, &block vs. def thingy(x, y, *z, &block) Like everyone else who has replied to this thread -- they're either explicitly stated or alluded to the fact that it's purely a matter of choice. For me, it's useful to fit my mindset as to what makes things clearer for me. For years, I have been using Java, and I *do* find the use of parenthesis around method calls useful in Ruby to make me realise what's going on. But it's just choice. When you consider things like: require 'foo' attr_reader :myvar Those dictate properties if you will of the class, so not adding parenthesis around them makes sense, despite them being methods in their own right. -- Thomas Adam