From: kwatch@... (kwatch) Date: 2002-05-09T05:59:00+09:00 Subject: Re: [Q] non-alphabetic character in symbol Thanks matz, I'm grad to meet(?) you. matz@ruby-lang.org (Yukihiro Matsumoto) wrote in message news:<1020834299.183881.7437.nullmailer@picachu.netlab.jp>... > > |This means that I must use intern() if I want to contain > |non-alphabetical character in symbol? > > Yes. Minero Aoki once proposed % notation for symbols, but consensus > was not made at the time. > > matz. OK, and another question: Which is faster, hash['+symbol'.intern()] or hash['+symbol'] ? Because :symbol is compiled directly when parsing and 'symbol'.intern() executes a method every time, I guess that :symbol is faster than 'symbol'.intern(), and hash[:symbol] is faster than hash['symbol'.intern()]. But I don't know if hash['symbol'.intern()] is faster than hash['symbol']. What I want to do is to use a string which contain '+', '-', '=', ... as a key of Hash. .------------------------------------------------- hash = Hash.new() hash['+symbol'.intern()] = 123; hash['+symbol'] = 456; .------------------------------------------------- I heard that symbol is faster than string as a key of Hash, but '+symbol'.intern() may be not so fast. Which is faster, hash['+symbol'.intern()] or hash['+symbol'] ? Regards, kwatch