On Thursday 05 January 2006 02:25 am, Dave Howell wrote:
> I was actually doing really well until the strange discussion involving
> throwing constants into the mix showed up, so I'm ignoring that.
>
> Steve's Newby Guide was excellent, if overly-complicated.
>
> Extremely useful item (I think from Gregory, but I'm not sure):
>
> 	attr_accessor "liquids", "solids"
>
> as effective and functional as
>
> 	attr_accessor :liquids, :solids

Yeah, that was quite a breakthrough for me too. I coded it to prove it to 
myself, and from that moment on I found that I knew when to use Symbols, and 
what I could accomplish by using them.

>
> So Steve, or anybody, I've learned that I can :mysymbol.to_i and I get
> an integer back. OK, I give up. What possible use do I have for this
> zany parlor trick? I'll hazard a guess that, as a "normal" programmer,
> not doing system-level stuff, not extending Ruby, not trying to do
> something dense and clever and incomprehensible...I don't.

Hi Dave,

I personally know of no use, in *my* application as opposed to Ruby internals, 
for the integer representation of a symbol.

>
> In fact, somebody correct me if I'm wrong, but I could actually never
> use a Symbol in a single line of Ruby code and I'd still be able to get
> everything done that I might reasonably want to.

Except for giving up symbols' memory advantages and (probably slight) 
performance advantages, that's my understanding also.
>
>
> Anyway, I'm quite confident I know what a Symbol is now. It's an
> immutable string.
>
> Stop!! Put your geek away! I didn't say it was a String. It's a string.
> It's a Merriam-Webster "string1" 5b(2) 'series of like objects (e.g.
> characters, bits, words)'. It's just a series of characters cemented
> together, bless its little stable self. What Ruby calls a String is
> actually some kind of pandimensional quasi-magic method-possessing
> self-modifying Object, and not an ordinary string at all.

I don't think it would hurt to think of it as an immutable string (not a 
String), in your own personal life. However, that probably would not go over 
well on a mailing list :-)


>
> Note that the neologism
>
> 	:symbol is to "symbol" as 1 is to "1"
>
> makes not one iota of sense unless one already understands all the
> complex ramifications of those quote marks. And given the extra magic
> powers of double quotes vs. single quotes, well, ick.

I never understood that analogy.

[clip]

> A Symbol is a non-variable variable (aka a constant) that always and
> only contains its own name.

That's an interesting and concise statement. I'll have to think about that.

SteveT
 
Steve Litt
http://www.troubleshooters.com
slitt / troubleshooters.com