[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Implementation of Symbols...

Logan Capaldo

1/27/2007 5:40:00 PM

On Sun, Jan 28, 2007 at 02:20:39AM +0900, Michael Cowden wrote:
> Ok, I'm sure this one has been addressed ump-teen times, but everything I read,
> at least on the rails side, puts symbols in the 'magic' space where you don't need
> to know how they're implemented--or what they are for that matter--you just need
> to know how to use them.
>
> Anyway, I've done a bit of programming in C so understanding it in those terms isn't
> going to hurt too much... can anyone explain?
>
> So far, the most elegant explanation comes from a discussion on LISP:
>
> "Symbol type: Symbols are effectively pointers to strings stored in a hash table. So you can test equality by comparing a pointer, instead of comparing each character."
>
Yeah, pretty much. If you really want to see, you can check out some of
the code in parse.c in and around the function rb_intern.
> from: http://www.paulgraham.com...
>
> Is this relevant?
>
> -Michael Cowden
> StoryRight.com
> michael.cowden@storyright.com
> (443) 519-8662

1 Answer

Michael Cowden

1/27/2007 5:54:00 PM

0

Thanks, I'm taking a look at it... it appears to handle all the cases for
global, instance variables, constants, etc.
But I'm not finding where it references a leading ':' on first glance....
http://www.ruby-doc.org/doxygen/current/parse_8c-s...

Can you give me a pointer? sorry for the pun

-Michael Cowden
StoryRight.com
michael.cowden@storyright.com
(443) 519-8662
----- Original Message -----
From: "Logan Capaldo" <logancapaldo@gmail.com>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Saturday, January 27, 2007 12:40 PM
Subject: Re: Implementation of Symbols...


> On Sun, Jan 28, 2007 at 02:20:39AM +0900, Michael Cowden wrote:
>> Ok, I'm sure this one has been addressed ump-teen times, but everything I
>> read,
>> at least on the rails side, puts symbols in the 'magic' space where you
>> don't need
>> to know how they're implemented--or what they are for that matter--you
>> just need
>> to know how to use them.
>>
>> Anyway, I've done a bit of programming in C so understanding it in those
>> terms isn't
>> going to hurt too much... can anyone explain?
>>
>> So far, the most elegant explanation comes from a discussion on LISP:
>>
>> "Symbol type: Symbols are effectively pointers to strings stored in a
>> hash table. So you can test equality by comparing a pointer, instead of
>> comparing each character."
>>
> Yeah, pretty much. If you really want to see, you can check out some of
> the code in parse.c in and around the function rb_intern.
>> from: http://www.paulgraham.com...
>>
>> Is this relevant?
>>
>> -Michael Cowden
>> StoryRight.com
>> michael.cowden@storyright.com
>> (443) 519-8662
>