From: "Jesús Gabriel y Galán" Date: 2011-09-13T16:11:17+09:00 Subject: Re: Any downsides to writing paranthesises? On Tue, Sep 13, 2011 at 7:57 AM, Vladimir Van Bauenhoffer wrote: > Chad Perrin wrote in post #1021546: >> To my knowledge, there is no technical difference for executing code >> between when it has parentheses and when it lacks them, as long as you >> don't run into precedence problems. > > What does precedence problems mean exactly? > >>For instance, these two lines of >> code have the same effects when executed: >> >>     Dir.glob("*txt") >>     Dir.glob "*txt" >> >> These two, however, do not: >> >>     Dir.glob("txt").map {|x| x.sub(/foo/, 'bar') } >>     Dir.glob "txt".map {|x| x.sub(/foo/, 'bar') } Precedence problems mean that the parser understands the second line as you calling the map method on the "txt" string, not on the result of Dir.glob, so the second line is equivalent to: Dir.glob("txt".map {|x| x.sub(/foo/, 'bar') }) which is clearly not the same as the first line. Jesus.