Strings vs. symbols

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Strings vs. symbols

Sean DeNigris
Any reason to prefer one over the other? I've seen both ways and it
doesn't seem to make a difference (other than less $' all over)...

e.g. "requires: #('CreepyCrawler');" vs. "requires: #(CreepyCrawler);"
Reply | Threaded
Open this post in threaded view
|

Re: Strings vs. symbols

Dale Henrichs
They should be Strings ... on Squeak and Pharo Strings and Symbols compare equal ('s' = #'s') which is a violation of the ANSI standard .... which is why they appear to work fine ... in GemStone Strings and Symbols don't compare equal and that can lead to no end of incorrect behavior ...

symbolic versions are the only place where symbols should show up in Metacello configurations....

I have hit more porting issues due to this than almost any other .... especially in tests that are written to "cut down on excess $'" when semantically the fields are "supposed to be Strings" (i.e.,the only place that Symbols ever used are the tests ... which are passing and noone is the wiser until the code is ported to a platform that conforms to the standard)...

Dale

----- Original Message -----
| From: "Sean DeNigris" <[hidden email]>
| To: "Metacello" <[hidden email]>
| Sent: Thursday, June 7, 2012 1:35:57 PM
| Subject: [Metacello] Strings vs. symbols
|
| Any reason to prefer one over the other? I've seen both ways and it
| doesn't seem to make a difference (other than less $' all over)...
|
| e.g. "requires: #('CreepyCrawler');" vs. "requires:
| #(CreepyCrawler);"
|
Reply | Threaded
Open this post in threaded view
|

Re: Strings vs. symbols

Sean P. DeNigris
Administrator
Dale Henrichs wrote
They should be Strings...  Symbols... can lead to no end of incorrect behavior ...
Wow, glad I asked!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Strings vs. symbols

Sean P. DeNigris
Administrator
In reply to this post by Dale Henrichs
Dale Henrichs wrote
symbolic versions are the only place where symbols should show up in Metacello configurations....
How about:
  #baseline vs. #'baseline'
  #stable vs. #'stable'

Any difference with/without quotes?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Strings vs. symbols

Dale Henrichs
no difference ....

when the tools rewrite a configuration method, I force symbols to be printed with the string quotes, because the rules for when the string quotes are used in Symbol printing varies from platform to platform, so I chose the lowest common denominator printString for Symbols to minimize the noise when looking at diffs.

Dale
----- Original Message -----
| From: "Sean P. DeNigris" <[hidden email]>
| To: [hidden email]
| Sent: Friday, June 8, 2012 2:12:46 PM
| Subject: [Metacello] Re: Strings vs. symbols
|
|
| Dale Henrichs wrote
| >
| > symbolic versions are the only place where symbols should show up
| > in
| > Metacello configurations....
| >
|
| How about:
|   #baseline vs. #'baseline'
|   #stable vs. #'stable'
|
| Any difference with/without quotes?
|
| --
| View this message in context:
| http://forum.world.st/Strings-vs-symbols-tp4633808p4633949.html
| Sent from the Metacello mailing list archive at Nabble.com.
|
Reply | Threaded
Open this post in threaded view
|

Re: Strings vs. symbols

Sean P. DeNigris
Administrator
Dale Henrichs wrote
I force symbols to be printed with the string quotes... to minimize the noise when looking at diffs.
Quotes it is :)
Cheers,
Sean