What's up with symbols?

  • Thread starter Hans-Eric Grönlund
  • Start date

H

Hans-Eric Grönlund

Hello fellows!

I'm trying to understand symbols. Not what they are, but rather why Ruby
has them. They are neat and I use them, but effectively you end up with
the same thing using plain strings, right? So why extend the language? I
get the feeling I'm missing a big point so please help me out by
pointing it out to me.

Best regards

Hans-Eric Grönlund
 
Ad

Advertisements

D

Daniel Harple

I'm trying to understand symbols. Not what they are, but rather why =20=
Ruby
has them. They are neat and I use them, but effectively you end up =20
with
the same thing using plain strings, right? So why extend the =20
language? I
get the feeling I'm missing a big point so please help me out by
pointing it out to me.

Hi,

See:

* [Symbols Are Not Immutable Strings][1]
* [Many previous discussions on the list][2]

[1]: http://onestepback.org/index.cgi/+Tech/Ruby/=20
SymbolsAreNotImmutableStrings.red
[2]: http://groups.google.com/group/comp.lang.ruby/search?=20
group=3Dcomp.lang.ruby&q=3Dsymbols&qt_g=3D1&searchnow=3DSearch+this+group

-- Daniel=
 
Ad

Advertisements

J

James Britt

Hans-Eric Gr=F6nlund said:
Hello fellows!
=20
I'm trying to understand symbols. Not what they are, but rather why Rub= y=20
has them. They are neat and I use them, but effectively you end up with= =20
the same thing using plain strings, right?=20

No. There was a lengthy thread about Symbols here on ruby-talk not too=20
long ago, so perhaps you'll want to search the archives.

So why extend the language? I=20
get the feeling I'm missing a big point so please help me out by=20
pointing it out to me.

See also

http://www.oreillynet.com/ruby/blog/2005/12/symbols_strings_methods_and_v=
a.html
http://www.oreillynet.com/ruby/blog/2005/12/digging_into_ruby_symbols_1.h=
tml



--=20
James Britt

"A language that doesn't affect the way you think about programming is=20
not worth knowing."
- A. Perlis
 

Top