From: ts Date: 2002-12-01T02:33:20+09:00 Subject: Re: Ruby Document >>>>> "S" == Shannon Fang writes: S> Can I omit this ::? Is it valid to omit it? or it has a "namespace" impact? yes, it has an impact. For example pigeon% cat b.rb #!/usr/bin/ruby class A; end p A == ::A, A module B p A == ::A, A class A end p A == ::A, A end pigeon% pigeon% b.rb true A true A false B::A pigeon% For the 2 first test, A and ::A make reference to the same class In the last test A make reference to the class B::A ::A make reference to the toplevel class A S> When should I use :: at top level? useless at toplevel :-) S> What is a symbol? what is the difference between symbol and variable? a symbol is an Object, like an Integer, Array, ... pigeon% ruby -e 'p :name.class; p 12.class' Symbol Fixnum pigeon% S> It seems HTTP#get is a class method? or if not? what is the symbol # mean, S> in method definition? This is just a convention HTTP#method is the convention for an instance method HTTP::method is the convention for a class method For example class HTTP def HTTP.get(a, b) end def gets(d) end end HTTP::get is a class method HTTP#gets is an instance method Guy Decoux