From: Shannon Fang Date: 2002-12-01T05:49:19+09:00 Subject: Re: Ruby Document Hi Bill, I get to know symbol more and more by talking with you ruby gurus... :) I know some of your examples, but still confusing :-( On Sun, 1 Dec 2002 04:05:36 +0900 "Bill Kelly" wrote: > irb> "some_symbol".intern > :some_symbol This is what I don't understand. "some_symobol" is a instant value, without a name. why the system assign a symbole :some_symbol to it? So if I have a string "This is a test" then the intern will be :This_is_a_test? That's sort of arbitrary... Relating to your explaination, and previous messages, I still have some vital question about understanding symbol: 1. I tested using IRB, it seems that a symbol is not related to the name. For example, irb(main):001:0> p :a.id 3602702 nil irb(main):002:0> a=3 3 irb(main):003:0> p a.id 7 nil irb(main):004:0> p :a.id 3602702 nil irb(main):005:0> It seems that I can create a symbol at any time, and it is not related to the name. For example, after a=3, :a still point to the same place. It seems that I have no way to use :a to reference to a? I am really confused... :(( 2. I guessed some usage of symbol in your explanation. Please have a look at the following javascript code: In the first alert, it will give out the name of the var you choose, but the second will give out the value of the var you choose. I vaguely guessed the use of symbol is related to this purpose. Can you implement the above JavaScript code in Ruby? Is it related to the use of symbol? Thanks a lot! Any ruby guru pls give me some hints! Shannon