[Glass] Differences between Symbol/String #= in Pharo and GemStone

Mariano Martinez Peck marianopeck at gmail.com
Sun Dec 8 17:46:53 PST 2013


HI guys,

I have this difference:

Pharo:

'aaa' asSymbol -> #aaa
#aaa = 'aaa' -> true

GemStone

'aaa' asSymbol -> #'aaa'
#aaa = 'aaa' -> false

That doesn't look like a big difference, but it is for me! One of the
reasons is that I have several dictionaries in which I have strings which
are stored as symbols...this is usually to save space, make the lookup
faster or some other reason. But then, at the time for searching in the
dict my object is a string... in pharo it worked, but here of course the
lookup fails. So yes, I have send as #asSymbol to the key before searching
it. But...that could be many places in code and maybe a bit hard to find.

So I wonder...anyway had a similar problem? What I was thinking is to
create a subclass of #SymbolKeyValueDictionary that implements #at: sending
#asSymbol to the argument...or a another subclass that instead of using the
normal #= does a bit of magic to make symbols and strings #=.

BTW....now that we are discussing about this...SymbolKeyValueDictionary
and StringKeyValueDictionary are more performant than KeyValueDictionary
when the keys are either string or symbols right?  I guess that's the
reason of their existence...but if you can confirm, that would be
appreciated.

Thanks!


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20131208/23272dfe/attachment.html>


More information about the Glass mailing list