--0-219621189-113580832316
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
How about devoting the next Ruby Quiz to coming up with the best-of-class examples, self paced-tutorial and documentation to settle the :symbol vs "string" issue? At some point you have to ask yourself are the explanations given so far to inquiring users adequate. The fact that this question keeps coming up must be seen as evidence that there is something lacking in the explanations previously given. At a minimum all the explanations give so far should be edited up into a FAQ entry that the experts can agree upon. Just my two cents.
6.1 What does :var mean? A colon followed by a name generates an integer(Fixnum) called a symbol which corresponds one to one with the identifier. "var".intern gives the same integer as :var, but the ``:'' form will create a local symbol if it doesn't already exist. The routines "catch", "throw", "autoload", and so on, require a string or a symbol as an argument. "method_missing", "method_added" and "singleton_method_added" (and others) require a symbol. The fact that a symbol springs into existence the first time it is referenced is sometimes used to assign unique values to constants: NORTH NORTH
SOUTH SOUTH
EAST EAST
WEST WEST
http://www.rubycentral.com/faq/rubyfaqall.html#s6
---------------------------------
Yahoo! for Good - Make a difference this year.
--0-219621189-113580832316--