<div dir="auto">Hi Boris, welcome back!</div><div dir="auto">I doubt this idea to generalize Symbol is really useful for Smalltalk. But I like to find analogies between math and Smalltalk, as you do too. I was just thinking about using the normal “intern” mechanism, with a Dictionary as before or with buckets like we have now, but allowing any object instead of only instances of String and UnicodeString.</div><div dir="auto"><br></div><div dir="auto">I tend to think of #= as an equivalence relation, and #== as the actual equality of set theory. I usually implement elements of quotients (of sets, groups, modules, rings, etc) stored as a representative element, and implement #= such that two elements are equal if their representatives are equivalent. For example, with integers modulo n, there would be a ModularInteger class with an instance variable ‘representative’ and ‘a = b iff a representative - b representative \\ n = 0’. It’s pretty straight forward, so I guess this is not exactly what you mean, I’ll read the reference you shared. Thank you!</div><div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Jan 27, 2025 at 17:48 Boris Shingarov via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Hi Luciano,<br>
<br>
First of all: sorry if I appear to be resurrecting a dead thread;<br>
this is fresh material to me as I just recently got reconnected to<br>
the world via Starlink after being stranded in a rural village for<br>
a couple of months.  I am active again.<br>
<br>
> If we think of == as equality, and = as an equivalence relation,<br>
> ...<br>
> more general Symbol with an instance variable ‘representative’,<br>
> that can be a String, or a UnicodeString (or possibly any object)?<br>
<br>
I think this is a hugely important idea.<br>
I have been struggling to implement quotient types (inspired by [1])<br>
for some time; what you are talking about is obviously not the same<br>
but it resonates a related note, reminding me of Lawvere's functions-<br>
as-fibres and all that.  Larger mathematics aside, I would like to<br>
understand how your representation works.  So we start with some<br>
object A.  If we send #asSymbol to it (or would #intern be a better<br>
name?) we arrive at some 𝒜, such that for any object B,<br>
<br>
(A = B) => (𝒜 == B asSymbol).<br>
<br>
How do you compute `B asSymbol` without searching through the whole<br>
object space (or at least through the set of allInstances, *if* we<br>
assume only same-class objects can be equal, which I am not sure about;<br>
and things would get even more exciting in, say, Bee with its<br>
instance-spacific behavior)?<br>
<br>
[1] <a href="https://dl.acm.org/doi/10.1145/3632869" rel="noreferrer" target="_blank">https://dl.acm.org/doi/10.1145/3632869</a><br>
<br>
<br>
On Fri, Nov 29, 2024 at 02:27:32PM +0700, Luciano Notarfrancesco via Cuis-dev wrote:<br>
> If we think of == as equality, and = as an equivalence relation, the Symbol<br>
> #xxx is just the equivalence class of all Strings ‘xxx’, and any String<br>
> instance ‘xxx’ is a representative of that equivalence class. This<br>
> construction is useful if you need to use objects under equality = in a<br>
> context where equality is == (for example, keys of an IdentityDictionary).<br>
> And, an IdentityDictionary with Symbols as keys is just like a Dictionary<br>
> with Strings as keys. So, from this point of view, a symbol should be all<br>
> about equality, about = and #hash.<br>
> <br>
> Now, in Cuis we have two parallel symbol classes depending on the type of<br>
> characters in their names: Symbol and UnicodeSymbol. Would it be better to<br>
> replace this with a single and more general Symbol with an instance<br>
> variable ‘representative’, that can be a String, or a UnicodeString (or<br>
> possibly any object)? What do you think?<br>
<br>
> -- <br>
> Cuis-dev mailing list<br>
> <a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
> <a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div></div>