From: "ara.t.howard" Date: 2007-11-08T02:38:20+09:00 Subject: Re: :: and . On Nov 7, 2007, at 9:45 AM, 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? > > thanks! i occasionally use '::' to get class values that are effectively constants/config. for instance if Monitor::interval > 42 also, i tend to use '::' if the class in question is stored in a variable, for example c = method_that_returns_a_class ... value = c::some_method simply because, when the code becomes complex, it helps my feeble mind recall that 'c' is indeed a class, and not a basic object. mostly though i think this is a religious issue. fyi, you can interchange '.' and '::' for normal objects too cfp:~ > ruby -e' p Object::new::object_id ' 76540 regards. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama