[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Is this old style Ruby?
From: Paul van Tilburg <paul () luon ! net>
Date: 2005-02-15 21:33:52
Message-ID: 20050215213335.GF3960 () power ! luon ! net
[Download RAW message or body]
On Wed, Feb 16, 2005 at 06:13:28AM +0900, Jason Voegele wrote:
> 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
--
Student @ Eindhoven | email: paul@luon.net
University of Technology, The Netherlands | JID: paul@luon.net
>>> Using the Power of Debian GNU/Linux <<< | GnuPG key ID: 0x50064181
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic