From: Scott Gonyea Date: 2010-10-11T12:50:53+09:00 Subject: Re: Why does a lot of code not include parenthesis? For starters - http://en.wikipedia.org/wiki/TMTOWTDI Second, ruby is very beautiful code. It's a tad bit of a mind fsck at first, which is a good thing. Programming languages are only valuable if they teach you how to think in different ways. Yes, the lack of parenthesis are irritating at first. If you stick with Ruby, and really dig in, you'll begin to get used to it. More important, you'll develop an opinion on how syntax *should* be. For me, I'm exceptionally pedantic on the following: - Declaring a method: Always use parenthesis - Calling a method: Don't use parenthesis unless you're trying to do something complicated (s/complicated/stupid/) - ie, # define def pow(num1, num2) num1 ** num2 end # call pow 10, 2 - also: if you use a single-letter variable name, I will kill you in your sleep I'm also a sticker on return statements. Ruby will return the last value in a method. That said, if your method is not simple, I'm very big on making sure everything is explicit. Also, I'm big on using parenthesis in a return statement. return(num1 ** num2) # ahhh In conclusion, you really won't find a gofmt.com edition for Ruby. It'd be more of a gofys.com. TMTOWTDI means a bit of freedom and, therefore, disagreement. I think that's a very healthy thing, albeit rage-inspiring at times. If you really can't handle it, Python was invented by some guy who clearly had to spend his internship days maintaining someone else's Perl code... Scott On Oct 10, 2010, at 5:25 PM, egervari wrote: > I just started playing around with ruby and rails, and one thing I've > noticed is that the style of the code is a little odd. People don't > use parenthesis most or even all of the time. > > I find this to look messy. It's hard to tell what is the method, what > is the variable, and how the code is formed at a glance. I actually > find the parenthesis to be more readable. There is no confusion at all > to what is going on, even if it's a bit more to type. > > Is there any reason tastes in style have changed? I think it would be > best to stick with the parenthesis just to make everything consistent. > It should be easier to refactor code and inline things if the > parenthesis were already there after all. > > Thoughts? >