From: Chad Perrin Date: 2007-06-12T19:50:26+09:00 Subject: Re: a matter of style On Tue, Jun 12, 2007 at 03:33:32PM +0900, Bas van Gils wrote: > > Yesterday I read part of Why's poignant guide to Ruby. I noticed that > :symbol's are used frequently.. is that also typical Ruby? I??e. write > > @someHash = { :foo => "bar" } > > rather than > > @someHash = { "foo" => "bar" } > > is so, is (memory)efficiency the main reason? I believe it's a combination of efficiency and readability. The differing syntax for a symbol as opposed to a string helps to provide an immediate visual cue to the fact that it's a hash key, since that's by far the most common place for symbols to be used (from what I've seen and done). It's also one fewer character and two fewer keystrokes to type, though I sincerely doubt that factors into most considerations. There may be other reasons that apply, but that's what immediately occurs to me. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] W. Somerset Maugham: "The ability to quote is a serviceable substitute for wit."