From: Yohanes Santoso Date: 2002-12-01T05:37:04+09:00 Subject: Re: Ruby Document "Shannon Fang" writes: > Can I omit this ::? Is it valid to omit it? or it has a "namespace" > impact? When should I use :: at top level? If you're not inside any namespace, then Net::XX and ::Net::XX means the same thing. However, if you are inside another namespace, let say you are inside module A, then Net::XX really means A::Net::XX if such thing is valid, or Net::XX if there is no A::Net::X. Because of this ambiguity, you can specify ::Net::X as the absolute namespace to choose. > What is a symbol? what is the difference between symbol and variable? If you're familiar with C, symbol is enum on steroid. Its primary usage is as a constant for user program. action=:sleep if action == :sleep then ... end :sleep.to_s ==> "sleep" > Can you tell me where in the document I can find the usage of symbole > and :name notation? The section "Ruby Language" in the pickaxe book is a good reference that you may be looking for. > > >S> - def HTTP.get( addr, path, port = nil ) > >S> Q: difference between HTTP.get and HTTP#get? I vaguely know there are a > >S> notation of class method and instance method, but which is which? and > > > > HTTP::get is a class method > It seems HTTP#get is a class method? or if not? what is the symbol # > mean, in method definition? HTTP.get ---> get is a class/module method of HTTP HTTP#get ---> get is an instance method of class HTTP (get is a method of an object of type HTTP) YS.