[Cuis-dev] Thoughts about symbols

Luciano Notarfrancesco luchiano at gmail.com
Thu Nov 28 23:27:32 PST 2024


If we think of == as equality, and = as an equivalence relation, the Symbol
#xxx is just the equivalence class of all Strings ‘xxx’, and any String
instance ‘xxx’ is a representative of that equivalence class. This
construction is useful if you need to use objects under equality = in a
context where equality is == (for example, keys of an IdentityDictionary).
And, an IdentityDictionary with Symbols as keys is just like a Dictionary
with Strings as keys. So, from this point of view, a symbol should be all
about equality, about = and #hash.

Now, in Cuis we have two parallel symbol classes depending on the type of
characters in their names: Symbol and UnicodeSymbol. Would it be better to
replace this with a single and more general Symbol with an instance
variable ‘representative’, that can be a String, or a UnicodeString (or
possibly any object)? What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20241129/33cb3a8c/attachment.htm>


More information about the Cuis-dev mailing list