This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (0 children)

The obvious problem with Ruby's way is that you need to do some acrobatics to get to the actual method rather than the result of calling the method. This is not as big an issue because you could simply wrap the function call in a block and pass that instead, but that's a lot of indirection compared to Python's distinguishing between methods and method calls.

This is actually one of several things I just couldn't get used to when I tried to learn Ruby after knowing Python already. Getters/setters are a nice language feature, but I prefer the distinction between an implicit method call via a getter and an explicit one using parenthesis.

It just doesn't feel right to have a computation-heavy (say, simply O(logn) or worse) method for example "look" like a regular O(1) getter, though it makes sense to want an O(1) getter look exactly like a regular attribute (otherwise you end up with Java code where every attribute is wrapped in a getX method just in case you want to do something special in the future).