What is the difference between :foo and "foo"?

On Sat, Dec 31, 2005 at 09:37:00AM +0900, Austin Z. wrote:

On 30/12/05, Chad P. [email protected] wrote:

. . . and please don’t point out that symbols don’t “do” anything, or
have any “behavior”. You (should) know what I mean from context.

Except that by trying to suggest that Symbols “act” a particular way
is nonsense. They don’t do anything, they don’t have any behaviour;
they just are simple names. In 99% of all uses of Symbols, that’s
absolutely all that matters.

I’m guessing you either didn’t read the preceding “you know what I mean”
statement, or you don’t actually know what I mean, or you’re being
intentionally combative.


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

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

On 30/12/05, Chad P. [email protected] wrote:

I’m guessing you either didn’t read the preceding “you know what I mean”
statement, or you don’t actually know what I mean, or you’re being
intentionally combative.

No, I didn’t know what you meant. I still don’t. Talking about the
behaviour of Symbols is nonsense. Talking about the implementation of
Symbols is (mostly) nonsense. Talking about what Symbols provide
(immediate values that are self-descriptive, like enums or consts) is
NOT nonsense. Trying to say much else about Symbols is, again, mostly
nonsense.

-austin

Austin Z. wrote:

Do I really care that they’re stored in Ruby on the internal symbol table?

No. Not in the last two and a half years have I cared once. Sure, it’s
nice that they only end up representing a single object, but I really
have never cared how they’re represented. I use them for what they
are, not how they’re implemented. And what they are, is names.

After trying to follow all this, I’ve come to see Symbols as being more
akin to numbers than strings.

They’re numbers with a human face.

James

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - Ruby Code & Style: Writers wanted
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

On Sat, Dec 31, 2005 at 09:43:54AM +0900, Austin Z. wrote:

absolutely all that matters.
I’m guessing you either didn’t read the preceding “you know what I mean”
statement, or you don’t actually know what I mean, or you’re being
intentionally combative.

No, I didn’t know what you meant. I still don’t. Talking about the
behaviour of Symbols is nonsense. Talking about the implementation of
Symbols is (mostly) nonsense. Talking about what Symbols provide
(immediate values that are self-descriptive, like enums or consts) is
NOT nonsense. Trying to say much else about Symbols is, again, mostly
nonsense.

rephrase:
“the behavior of the language as regards the use of symbols”

Does that help?

Just replace all references to the behavior of symbols with whatever is
necessary, in your world-view, to map to the concept of what happens
when you use symbols in your source code.


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

unix virus: If you’re using a unixlike OS, please forward
this to 20 others and erase your system partition.

On Sat, Dec 31, 2005 at 09:46:00AM +0900, James B. wrote:

After trying to follow all this, I’ve come to see Symbols as being more
akin to numbers than strings.

They’re numbers with a human face.

That’s actually, from what I can see, a very good description – though
for a complete newbie to the concept, you’d probably need to expand on
that a little bit.


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

unix virus: If you’re using a unixlike OS, please forward
this to 20 others and erase your system partition.

On 30/12/05, Chad P. [email protected] wrote:

rephrase:
“the behavior of the language as regards the use of symbols”

Does that help?

Just replace all references to the behavior of symbols with whatever is
necessary, in your world-view, to map to the concept of what happens
when you use symbols in your source code.

Not really. I think James’s description is pretty good, and agree that
it needs expansion. However, I don’t think that the Ruby language
behaves in any particular way relating to Symbols or their use. I’m
not sure how to get it clearer than that. The Ruby language doesn’t
really behave in a particular way with respect to Fixnums that impacts
most developers who use the language. The implementation has to deal
with them specially, and there are corner cases related to the current
implementation’s use of 31 bits and the upsize and downsize between
BigDecimal, but that is, as I’m saying, an implementation issue and
not something I see as intrinsic to the language.

-austin

On 30/12/05, Chad P. [email protected] wrote:

not something I see as intrinsic to the language.
Let me put it this way, then: Why don’t we remove symbols from the
language?

Strictly speaking, I do not believe that there is a need for them in
the language as such. They are, after all, just immediate objects.
(Which, combined with a “native” constructor syntax, is perhaps the
only reason to make them part of the interpreter.) Aside from that,
however, if they didn’t exist in the language, there would likely be
some similar concept created.

Ruby-the-language probably doesn’t need them as much as
ruby-the-interpreter does. But they don’t actually do anything
special within the language, so far as I can tell. I suggest you look
at it realistically, instead of wanting to make them into something
they aren’t.

Once you answer that, I’ll take your phrasing and fit it into what I was
saying, and this ridiculous back-and-forth wherein you refuse to
communicate effectively with me can end.

I’m communicating. You’re just not listening. Effective communication
requires a willing listener, and you seem to be uninterested in such.

-austin

On Sat, Dec 31, 2005 at 11:50:27AM +0900, Austin Z. wrote:

not something I see as intrinsic to the language.
Let me put it this way, then: Why don’t we remove symbols from the
language?

Once you answer that, I’ll take your phrasing and fit it into what I was
saying, and this ridiculous back-and-forth wherein you refuse to
communicate effectively with me can end.


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

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

On 12/30/05, Austin Z. [email protected] wrote:

I’m communicating. You’re just not listening. Effective communication
requires a willing listener, and you seem to be uninterested in such.

I traded a few emails off list with Chad and he seems to basically be
only interested in telling everyone how wrong they are and how he
doesn’t understand our ‘inadequate’ explanations.

Just killfile the annoying bastard, you’ve explained symbols great
already.

By the way, I’m currently working on a sort of abstract document class
for Ruport that will let you use XML, YAML or pure ruby to set up a
structured document and then output it as a PDF using your library, or
in other formats.

I thought you might find that interesting. Ruport will soon depend on
PDF::Writer, as I’m going to begin putting some major PDF support to
it. If i make any progress in the way of things that can be
generalized down and put into PDF::Writer (such as charts), I’ll let
you know.

Any word on the SVG status in PDF::Writer?

Cheers,
Greg

Ryan L. wrote:

doesn’t understand our ‘inadequate’ explanations.

[further private conversation snipped]

You guys really need to watch it when you hit reply.

Also, could we for goodness sakes let this thread die?!? Please?!?

Recent threads (here and elsewhere) considered, 2006 can’t come soon
enough; time to start fresh.

Happy Hacking New Year!

James

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - Ruby Code & Style: Writers wanted
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

On 12/30/05, Ryan L. [email protected] wrote:

On 12/30/05, Gregory B. [email protected] wrote:

On 12/30/05, Austin Z. [email protected] wrote:

I’m communicating. You’re just not listening. Effective communication
requires a willing listener, and you seem to be uninterested in such.

I traded a few emails off list with Chad and he seems to basically be
only interested in telling everyone how wrong they are and how he
doesn’t understand our ‘inadequate’ explanations.

You guys really need to watch it when you hit reply.

Whoa! Sorry about that. That’s twice in one day for me :frowning:

On 12/30/05, Gregory B. [email protected] wrote:

On 12/30/05, Austin Z. [email protected] wrote:

I’m communicating. You’re just not listening. Effective communication
requires a willing listener, and you seem to be uninterested in such.

I traded a few emails off list with Chad and he seems to basically be
only interested in telling everyone how wrong they are and how he
doesn’t understand our ‘inadequate’ explanations.
[further private conversation snipped]

You guys really need to watch it when you hit reply.

Also, could we for goodness sakes let this thread die?!? Please?!?

Ryan

On Sat, Dec 31, 2005 at 01:19:37PM +0900, Austin Z. wrote:

I’m communicating. You’re just not listening. Effective communication
requires a willing listener, and you seem to be uninterested in such.

My point exactly: I used sloppy phrasing to try to get a point across,
made sure I identified it as sloppy phrasing, and you’ve done everything
in your power to nitpick my phrasing rather than grok my meaning.


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

print substr(“Just another Perl hacker”, 0, -2);

On Sat, Dec 31, 2005 at 01:34:26PM +0900, Gregory B. wrote:

I traded a few emails off list with Chad and he seems to basically be

Funny, I don’t recall receiving said off-list emails.


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

print substr(“Just another Perl hacker”, 0, -2);

Please end this thread, for the sake of all things good and decent.

~ ryan ~

On 12/31/05, J. Ryan S. [email protected] wrote:

Please end this thread, for the sake of all things good and decent.

Agreed. I apologize for throwing fuel on the fire accidentally.

If nothing else, the difference between “foo” and :foo has been
answered.

Let’s all be friends :wink:

On 12/31/05, Chad P. [email protected] wrote:

On Sat, Dec 31, 2005 at 01:34:26PM +0900, Gregory B. wrote:

I traded a few emails off list with Chad and he seems to basically be

Funny, I don’t recall receiving said off-list emails.

Look back through this thread, a few of my messages were sent just to
you and not to the list. The post to Austin was also meant to be
private. Okay, I’m done with this thread now :slight_smile:

Happy new year, all

On Fri, 30 Dec 2005 13:05:48 -0000, Malte M.
[email protected]
wrote:

a is a reference to :sym and b is a reference to 3.

Have I been wrong all the time?

I wonder that too. What about:

a, b = :sym, :sym

I guess a and b hold separate references to the same object, much as if
I
did

a, b = 4, 4

That was the basis for my mentioning literal fixnums earlier in the
‘:foo
and “foo”’ thread, but now I wonder if I’m in fact wrong (again ;)).

Basically I suppose I’m confused about assignment by value or reference.
I
though Ruby was pass by reference, with references passed by value, no
matter what?

dblack:

Actually, s = :sym doesn’t produce a reference to :sym;
rather, s has the actual/immediate value :sym. Anyway, the main (obscured)
point was that symbols are not references.

My understanding of things so far was that :sym and 3 are immediate
values,
and after writing
a, b = :sym, 3
a is a reference to :sym and b is a reference to 3.

Have I been wrong all the time?

Malte

Malte M. [email protected] writes:

dblack:

Actually, s = :sym doesn’t produce a reference to :sym;
rather, s has the actual/immediate value :sym. Anyway, the main (obscured)
point was that symbols are not references.

My understanding of things so far was that :sym and 3 are immediate values,
and after writing
a, b = :sym, 3
a is a reference to :sym and b is a reference to 3.

In the current implementation, no. It doesn’t matter to the
programmer, though.