Symbol>>capitalized?

Terry Raymond squeak-craft at cox.net
Tue Jan 2 17:24:21 UTC 2007


I would not recommend this. Normally, one would expect
that a transformation like #capitalized would return an
object of the same class. It would make more sense to
define #asCapitalizedString and change the code to use it.

Terry
 
===========================================================
Terry Raymond       Smalltalk Professional Debug Package
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      traymond at craftedsmalltalk.com
<http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of Todd Blanchard
> Sent: Monday, January 01, 2007 7:05 PM
> To: The general-purpose Squeak developers list
> Subject: Symbol>>capitalized?
> 
> Squeak 3.7 ish -
> I've got this meta model that stores attribute names as symbols.
> 
> I frequently derive labels from the attribute names and this often
> ends up calling #capitalized on the symbol.
> 
> I generally figure any string manipulation on a symbol results in a
> string but Symbol>>capitalized is implemented as
> 
> capitalized
> 
> 	^self asString capitalized asSymbol
> 
> I found this while watching the process browser running a lengthy
> script in the background and found about 80% of time was spent in
> WeakSet scanFor:
> 
> I did a search of the image and couldn't find a single instance of
> sending capitalized to a symbol where the caller was going to use it
> as a symbol rather than a string.
> 
> So, in the name of performance, I vote to nuke this method or change
> it to just return a string.




More information about the Squeak-dev mailing list