Ruby Document

Thanks again, but for give my dumbness, still some questions:

What is a symbol? what is the difference between symbol and variable?

a symbol is an Object, like an Integer, Array, …

According to the manual:
“A Ruby symbol is the internal representation of a name. You construct the
symbol for a name by preceding the name with a colon. A particular name will
always generate the same symbol, regardless of how that name is used within
the program.”

Does it mean: If I see a symbol in a program, like :PropFind, I can safely
assume that in the same program, there are a name PropFind, which is related
to this symbol?

Another question is, if the above understanding is right (or wrong), what is
the use of a Symbol? Why need a symbol? what is the difference between
:PropFind and PropFind?? I do need some documents, otherwise might keep
harassing you people :-p

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
In your above example, :: and # is only used in documents? But in real
program, you only use “.”? So in def clause within a class, if classname is
used as above, it is class method?

Shannon

···

Guy Decoux


MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus

Another question is, if the above understanding is right (or wrong), what is
the use of a Symbol? Why need a symbol? what is the difference between
:PropFind and PropFind??

Just try it

pigeon% ruby -e 'p :PropFind'
:PropFind
pigeon%

pigeon% ruby -e 'p PropFind'
-e:1: uninitialized constant PropFind (NameError)
pigeon%

                         I do need some documents, otherwise might keep
harassing you people :-p

"Programming Ruby" is fine for english people.

      http://165.193.123.250/book/index.html

In your above example, :: and # is only used in documents?

                                                            But in real
program, you only use "."?

Well, you can use also :: in a real program

                          So in def clause within a class, if classname is
used as above, it is class method?

yes,

Guy Decoux