From: Eero Saynatkari Date: 2005-12-27T08:31:37+09:00 Subject: Re: Forwardable -- :[] -- :@what Warren Seltzer wrote: > Reading about Forwardable I was shocked to see strange symbol-looking > notations I'd never > seen before. Nothing the pickaxe led me to believe that :[] or > :@variable was valid Ruby. > I've since figured out, I think, what it must mean but I'm wondering: > What other crazy > syntax am I going to have to figure out? And does :[] simply name a > function, as I think? : just indicates the variable being a Symbol, just like the quotes in 'something' indicates that variable to be a String. A Symbol does not intrinsically refer to a method, it is just a name (you could just as well use a String): foo.send :foobar_method # is equivalent to foo.send 'foobar_method' So, conceptually, :[] is more or less the same as '[]' and it may, indeed, be good to think of a Symbol as a kind of an immutable String :) > Will I be seeing :&, :**, :) and so on? Or even :-) ? Well, (:-) is valid as the minus operator.. > Shocked, simply shocked... Ha! Wait until you start constructing Symbols using the implicit String conversion: :'This is a Symbol too' > Warren Seltzer E -- Posted via http://www.ruby-forum.com/.