[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

OT: What is in a name? (was: Demystifying Symbols

Gary Wright

1/5/2006 10:48:00 PM

On Jan 5, 2006, at 3:54 PM, Steve Litt wrote:
> On Thursday 05 January 2006 02:25 am, Dave Howell wrote:
>> 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 :-)

This is pretty far off topic but might be of some interest to some of
you
(or none of you).

I don't think of my personal name as the immutable string composed of
the roman letters G a r y. My name is Gary and it has the properties of
a name not the properties of a sequence of Roman letters. In fact
there are
a variety of character sequences that can be interpreted as my name:

G a r y
G A r y
g A R Y
g a r y

and if you want to switch to a different font or UTF-8 or whatever, then
the list is endless. You can also convert my name to sound waves and it
works as a name also. There are other people who share my name. Most of
them I've never met and never will meet but we have this abstract thing,
a name, in common. Someone, somewhere probably has a dog named Gary.
But that doesn't mean he is named after me or I'm named after him. We
just share the name. Maybe some Ruby programmer has created
a class named Gary without asking me if it was OK, or maybe it was a
Java programmer.

In fact, names don't even have to be associated with anything in
particular
they can exist independent of any referent. For example, I don't think
anything has ever been given the name AdafkeqkndkXXXgkos, but
that particular name just got created at the moment I referenced it
and it
happens to have an analogous string of Roman letters. Maybe it is
pronounceable (probably in Klingon). If you looked at
the binary values of those letters encoded in ASCII and considered them
as just one big binary value then you could say there is a particular
integer value that is analogous to that name also. The integer
1197568633 is analogous to my name as is 47617279 and 13m2sjp or
alternatively
1197568633, 47617279, and 13m2sjp are all names for one particular
mathematical integer. You could say that integer has the name Gary.

I think in a very deep, conceptual way, Ruby symbols behave like names
just as Ruby fixnums behave like integers.

But maybe I'm just weird.

:Gary :Wright


2 Answers

Ross Bamford

1/5/2006 11:59:00 PM

0

On Thu, 05 Jan 2006 22:48:07 -0000, <gwtmp01@mac.com> wrote:

>
> I think in a very deep, conceptual way, Ruby symbols behave like names
> just as Ruby fixnums behave like integers.
>

That's exactly the kind of feeling I was going with when I made that naive
'Symbols are names' comment way back when. You put it into words better
than I ever could :)

Cheers,

--
Ross Bamford - rosco@roscopeco.remove.co.uk

Yohanes Santoso

1/6/2006 3:22:00 PM

0

"Ross Bamford" <rosco@roscopeco.remove.co.uk> writes:

> On Thu, 05 Jan 2006 22:48:07 -0000, <gwtmp01@mac.com> wrote:
>
>>
>> I think in a very deep, conceptual way, Ruby symbols behave like names
>> just as Ruby fixnums behave like integers.
>>
>
> That's exactly the kind of feeling I was going with when I made that
> naive 'Symbols are names' comment way back when. You put it into
> words better than I ever could :)
>
> Cheers,
>
> --
> Ross Bamford - rosco@roscopeco.remove.co.uk

It's not naive and it's closer to the truth then other descriptions so
far. However, it seems for some people the concept of being able to
represent names directly seems scary and foreign. Probably due to the
numerous years of working with languages that have imporverished
language constructs.

It is the same concept of being able to represent integers directly,
but since most languages allow direct integer representations, it is
not perceived as scary and foreign.

Why would they care about how Symbol is implemented is beyond me, as
if knowing how Fixnum is implemented would enhance their understanding
of what an integer is and how to appropriately use it.

YS.