# Rue teaches piglet about symbols on #ruby-lang

**URL:** <https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925>\
**Category:** Ruby\
**Created:** [January 9, 2006, 10:04am UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925 "2006-01-09T10:04:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 9, 2006, 10:04am UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/1 "2006-01-09T10:04:25Z")

</div>

Taken from #ruby-lang with a slight cleanup  
(I am piglet)

- piglet wonders if someone would be so kind to explain what a symbol  
is slowly and clearly so his simple pig brain will understand. “A  
symbol is the name of an object” just doesn’t grok.

dagbrown: It’s a name without an object attached to it.  
rue: Oo, let me try my state again!  
rue: It is a name or description that is only meaningful to the  
programmer  
rue: Like you can say @status = :connected  
rue: The :connected does not mean anything to ruby, only you. You have  
decided to call this particular status :connected

- piglet tries hard not to look confused.  
piglet: how does this fit in with .to\_sym or .to\_i then?  
rue: Those are just ways to construct (or deconstruct) a symbol  
rue: The implementation is secondary and has no inherent meaning  
rue: So long as you understand what symbols are for (:connected), you  
are golden. Then you can take a look at implementation details  
piglet: ah seems clearer now… still fuzzy though…  
rue: Is there a particular usage that is confusing?  
piglet: i’ll get back to you, let me meditate some more  
piglet: i like playing with things in irb until i understand, but  
these symbols are weird  
rue: One more! You could just as well write attr\_accessor ‘foo’ . You  
are just saying the name of the method you want to create.  
rue: All these people with their ‘immediate values’ and ‘integer  
representations’ are out to confuse people, I think 🙂  
piglet: someone should let them know they’ve won, so they will stop  
rue: Yep. But do you, sort of, see I what I am saying? They are just  
names that are meaningful to YOU. Instead of having to say @status =  
1, you can say @status = :connected  
Pieter: symbols are like integers you pass to a method to select a  
state or something. With symbols you can use human-readable objects  
instead of integers
- rue hopes for a tentative ‘yes’  
rue: That would mean we are about 8000 lines of text better than  
ruby-talk 🙂  
piglet: rue I get it 🙂  
Pieter: wow 🙂  
rue: Yays 😛  
piglet: are symbols more better, or just ‘more meaningful’?  
Pieter: you should post the log to ruby-talk and pimp  
rue: More meaningful.  
rue: As I mentioned, there are some implementation details that may be  
interesting in the current ruby.
- piglet is satisfied 🙂  
rue: The thing that is mostly at the root of all this confusion is  
that ruby itself creates some symbols. Mostly because it is a  
convenient  
rue: The second thing --and this is _completely useless knowledge_–  
is that symbols are in fact processed as ‘immediate values’.  
piglet: I guess I have to ask what an immediate value is now.  
Pieter: 🙂  
rue: Normal objects are held as references. Say, a = ‘foo’, a does  
not actually contain the object, just a reference  
rue: Fixnums and Symbols are actually stored ‘in’ the variable  
(references are integers too).  
rue: But these are just optimizations. There is no functional reason  
this is the way it is.  
piglet: fixnums and symbols are faster then because they are actually  
stored in the variable and not just being pointed to by the variable?  
rue: Precisely.  
piglet: I didnt know ruby stored anything in its variables besides  
pointer type things  
rue: Yep --and the important bit is that it does not matter if it does  
or not.  
piglet: no it wouldnt matter, but its interesting to know  
rue: Oh, hell, I will post on ruby-talk. At least they will have  
something to talk about tomorrow even if it is bashing our methodology  
😛  
piglet: rue, would you mind if I do as Pieter says and post this convo  
to ruby-lang, I bet someone will get something out of it.  
rue: Oh, sure. Just paste the whole thing all the way down here 🙂  
piglet: 🙂

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 9, 2006, 1:35pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/2 "2006-01-09T13:35:36Z")

</div>

On Mon, Jan 09, 2006 at 06:01:50PM +0900, Alex C. wrote:

> Taken from #ruby-lang with a slight cleanup  
> (I am piglet)

Woah, that was confusing.

–  
Chad P. [CCD CopyWrite | [http://ccd.apotheon.org](http://ccd.apotheon.org) ]

“Real ugliness is not harsh-looking syntax, but having to  
build programs out of the wrong concepts.” - Paul Graham

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 9, 2006, 6:07pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/3 "2006-01-09T18:07:38Z")

</div>

Quoting Chad P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> On Mon, Jan 09, 2006 at 06:01:50PM +0900, Alex C. wrote:
> 
> > Taken from #ruby-lang with a slight cleanup  
> > (I am piglet)
> 
> Woah, that was confusing.

“I am piglet.”

Another stands. “No, I am piglet.”

“I am piglet.” Another.

“I am piglet!”

Soon, the crowd is awash with the declaration: “I AM PIGLET!”

Marcus Licinius Pooh looks on, confounded.

-mental

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 9, 2006, 7:17pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/4 "2006-01-09T19:17:18Z")

</div>

Chad P. wrote:

> On Mon, Jan 09, 2006 at 06:01:50PM +0900, Alex C. wrote:
> 
> > Taken from #ruby-lang with a slight cleanup  
> > (I am piglet)
> 
> Woah, that was confusing.

“When I use a symbol,” Humpty Dumpty said, in a rather scornful tone,  
“it means just what I choose it to mean - neither more nor less.”  
“The question is,” said Alice, “whether you can make symbols mean so  
many different things.”  
“The question is,” said Humpty Dumpty, “which is to be master - that’s  
all.”

– With apologies to Lewis Carroll (1832-1898) Through The Looking Glass  
1871

James

–

[http://www.ruby-doc.org](http://www.ruby-doc.org) - Ruby Help & Documentation  
[Ruby Code & Style](http://www.artima.com/rubycs/) - The Journal By & For Rubyists  
[http://www.rubystuff.com](http://www.rubystuff.com) - The Ruby Store for Ruby Stuff  
[http://www.jamesbritt.com](http://www.jamesbritt.com) - Playing with Better Toys  
[http://www.30secondrule.com](http://www.30secondrule.com) - Building Better Tools

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 9, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/5 "2006-01-09T22:37:07Z")

</div>

The reason its so confusing is because that was an actual irc  
conversation.  
At the time it made a lot of sense… guess you just had to be there.

On 1/9/06, Chad P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Mon, Jan 09, 2006 at 06:01:50PM +0900, Alex C. wrote:
> 
> > Taken from #ruby-lang with a slight cleanup  
> > (I am piglet)
> 
> Woah, that was confusing.

The reason it is so confusing is because that was an actual irc  
conversation.  
At the time it made a lot of sense… guess you just had to be there.

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 10, 2006, 4:45am UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/6 "2006-01-10T04:45:30Z")

</div>

On Mon, Jan 09, 2006 at 06:01:50PM +0900, Alex C. wrote:

> Taken from #ruby-lang with a slight cleanup  
> (I am piglet)

Surely piglet meant

I am :piglet

🙂

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 9, 2006, 11:55pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/7 "2006-01-09T23:55:58Z")

</div>

On 9-Jan-06, at 12:06 PM, removed\_email\_address@domain.invalid wrote:

> Another stands. “No, I am piglet.”
> 
> “I am piglet.” Another.
> 
> “I am piglet!”
> 
> Soon, the crowd is awash with the declaration: “I AM PIGLET!”
> 
> Marcus Licinius Pooh looks on, confounded.
> 
> -mental

That is a scenario Roo would rue.

Mike

–

Mike S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://www.stok.co.uk/~mike/](http://www.stok.co.uk/~mike/)

The “`Stok’ disclaimers” apply.

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 11, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/8 "2006-01-11T17:27:02Z")

</div>

Alex C. wrote:

> rue: That would mean we are about 8000 lines of text better than ruby-talk 🙂

You mean someone doesn’t find cleverly disguised flames and small-scale  
holy wars over the simplest statements as helpful and an enrichening  
readig experience? Gasp! My youthful dreams and illusions shattered. Oh,  
that means I’ll have to pledge not to spam the list with my two cents on  
topics dead for a week…

David V.  
Senior Compulsive Liar, part-time Spammeister

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 11, 2006, 8:13pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/9 "2006-01-11T20:13:37Z")

</div>

On 1/11/06, David V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Alex C. wrote:
> 
> > rue: That would mean we are about 8000 lines of text better than ruby-talk 🙂
> 
> You mean someone doesn’t find cleverly disguised flames and small-scale  
> holy wars over the simplest statements as helpful and an enrichening  
> readig experience? Gasp! My youthful dreams and illusions shattered. Oh,  
> that means I’ll have to pledge not to spam the list with my two cents on  
> topics dead for a week…

As long as you’re not the one initiating or perpetuating these “flames  
and small-scale holy wars” then by all means feel free to resurect  
long dead topics.

There is a lot of stuff happening in the list that I dont comment on  
because I’m  
too newb yet, but if the topic is still active in a few week or months  
perhaps I’ll  
have something interesting to say, or at the very least a good question  
to ask…

Some topics should never die.

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 11, 2006, 8:53pm UTC](https://www.ruby-forum.com/t/rue-teaches-piglet-about-symbols-on-ruby-lang/51925/10 "2006-01-11T20:53:21Z")

</div>

Alex C. wrote:

> > You mean someone doesn’t find cleverly disguised flames and small-scale  
> > long dead topics.

Depends on the time of day, season of the year, caffeine level, sexual  
drive, and the position of Jupiter’s moons…

David V.
