[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: different between the "::" and "."
From:       Ken Bloom <kbloom () gmail ! com>
Date:       2010-12-12 4:10:06
Message-ID: pan.2010.12.12.03.30.21 () gmail ! com
[Download RAW message or body]

On Sat, 11 Dec 2010 22:25:17 +0900, zuerrong wrote:

> Hello,
> 
> class Myclass
>     def Myclass.hi
>          "hi"
>     end
>     def Myclass::hello
>          "hello"
>     end
> end
> 
> what's the difference between Myclass.hi and Myclass::hello here?
> 
> Thanks.

Quoting Pickaxe (p349):

The only difference between :: and . occurs with uppercase identifiers. 
Ruby will assume that receiver::Thing is actually an attempt to access a 
constant named Thing unless the method invocation has a parameter list 
between parentheses





-- 
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic