[Seaside] Is your code for your Seaside web-appusing concisemethods?

Ramon Leon ramon.leon at allresnet.com
Wed Jan 24 20:12:24 UTC 2007

> Hmm.. I'm not sure I've ever really looked at ST symbols 
> before.. I gather (upon doing a little homework just now) 
> that I just need to use something like #MyDivName or similar 
> to get a symbol instead of a string such as 'MyDivName' like 
> I am doing currently?  I guess I didn't really realize that 
> ST was likely to be keeping multiple copies of those strings 
> for all of the different methods that were using them.. Are 
> there any other pitfalls with using symbols?  I ran across a 
> blog entry suggesting that new ST'ers frequently use 
> gratuitous use of symbols and have big performance hits (see 
> link below
> -- particularly the last comment)
> under certain conditions.. I'll have to admit that they 
> indicate that you should use "asSymbol" to get the symbol 
> object instead of creating what would sound (to me anyway) 
> like another symbol..
> Am I barking up the wrong tree or just misunderstanding symbols?
> http://www.cincomsmalltalk.com/userblogs/troy/blogView?showCom
> ments=true&entry=3313219321
> Many thanks so far for the great info Ramon!

No problem, I like seeing how other people code, you never know when you
might accidentally learn something from someone else's code.

If you want to tag something with an identifier, use a symbol.  A symbol is
just a globally unique string.  They allow for faster comparisons because
they can be compared with == rather than =.  However, I use them for
semantic reasons, not performance reasons.  Symbols are for keying and
identifying things, strings generally aren't.  Symbols also have the
advantage of being checked by the refactoring browser when you rename
methods.  Symbols are kind of like undeclared constants in other languages.

Ramon Leon

More information about the Seaside mailing list