From: David Masover Date: 2010-10-13T08:20:01+09:00 Subject: Re: Why does a lot of code not include parenthesis? On Monday, October 11, 2010 09:58:40 pm ara.t.howard wrote: > the only real argument for requiring parens is so that > > o.foo # returns the method foo > > as in javascript. other arguments are mostly religious. I actually really like this about JavaScript, but as it turns out, JavaScript has getters and setters. I'm guessing they've been added to the language itself because they pretty much always existed as part of the browser's API -- think "location.href = foo" -- so it makes sense to expose them to developers. So here, the only real question is whether it's more common to want to deal with methods directly this way, or to want to refactor instance variables into methods. I like that Ruby's approach has everything entirely encapsulated by default -- attr_accessor means I always have the option to replace an instance variable with a pair of methods. True, I have setters and getters in JavaScript, but they're the default in Ruby.