From: joey eisma Date: 2007-11-08T06:01:08+09:00 Subject: Re: :: and . --0-316412667-1194469217=:77269 Content-Type: text/plain; charset=us-ascii thx everyone for the reply. for the fine examples (some i don't quite understand yet..) as i'm still in the very early stages yet.. can i assume that it's simplier to use . than :: for references to methods? thanks! ----- Original Message ---- From: Alex Young To: ruby-talk ML Sent: Wednesday, November 7, 2007 10:13:01 AM Subject: Re: :: and . joey eisma wrote: > hi! > > reading through some tutorial, i noticed the author would interchange using :: and . to call methods. i see they both give the same result. > > i was wondering if there is any other difference between the two? (other than convenience maybe?). when would you use one over the other? > In addition to the other answers, there's one place that you can only use '::' rather than '.', and that's when you're specifying that your constant should be searched for in the root namespace: Bar = 42 module Foo Bar = 23 def Foo.show p ::Bar p Bar end end Foo.show outputs: 42 23 -- Alex __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-316412667-1194469217=:77269--