P
Paul van Tilburg
Florian Gross said:And you can not use :: for accessing methods that start with an
uppercase letter:
That's not exactly true:
[...]
If you supply a parameter list (or even empty parentheses), ruby will use
:: for accessing methods with an uppercase letter, otherwise it will
assume you are trying to access a constant.
That's exactly why I use . for both class and instance method-calls
and :: for constants, there still is this overlap but a better
semantical devision. Since :: gives a feel for working with
"namespaces" (Foo::Bar, Foo::Bar::Konstant) and class and module names are
constants too. The . is well-known for method calls (regardless the tape)
and you also don't do: def MyClass::classmethod; ... ; end.
That's the guideline I follow at least, just my 2¢.
It seems to be clearer for RubyNubies too (in my experience explaining
instance methods, class methods and namespaces to them).
Paul
[/QUOTE]