From: Gavin Sinclair Date: 2003-02-04T07:50:24+09:00 Subject: Re: Designing API strings vs symbols? On Tuesday, February 4, 2003, 9:35:39 AM, ahoward wrote: > On Mon, 3 Feb 2003, Travis Whitton wrote: > i know exactly what you are talking about : symbols look nice, but strings are > more inline with cgi programming internals > why not support both? > def method s > s = s.intern if String === s # use symbols internally > end > or > def method s > s = s.to_s.gsub /^:/, '' if Symbol === s # use strings internally > end I can't believe that gsub is necessary, and I'm right. :frog.to_s == "frog" Anyway, I prefer symbols to strings as "properties": they display a greater deal of intention: that the hash will work with these values as keys and none, or little, other. I expect it's more efficient, too. Gavin