[Cuis-dev] Thoughts about symbols

Luciano Notarfrancesco luchiano at gmail.com
Mon Jan 27 04:33:46 PST 2025


Hi Boris, welcome back!
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.

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!

On Mon, Jan 27, 2025 at 17:48 Boris Shingarov via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi Luciano,
>
> First of all: sorry if I appear to be resurrecting a dead thread;
> this is fresh material to me as I just recently got reconnected to
> the world via Starlink after being stranded in a rural village for
> a couple of months.  I am active again.
>
> > If we think of == as equality, and = as an equivalence relation,
> > ...
> > more general Symbol with an instance variable ‘representative’,
> > that can be a String, or a UnicodeString (or possibly any object)?
>
> I think this is a hugely important idea.
> I have been struggling to implement quotient types (inspired by [1])
> for some time; what you are talking about is obviously not the same
> but it resonates a related note, reminding me of Lawvere's functions-
> as-fibres and all that.  Larger mathematics aside, I would like to
> understand how your representation works.  So we start with some
> object A.  If we send #asSymbol to it (or would #intern be a better
> name?) we arrive at some 𝒜, such that for any object B,
>
> (A = B) => (𝒜 == B asSymbol).
>
> How do you compute `B asSymbol` without searching through the whole
> object space (or at least through the set of allInstances, *if* we
> assume only same-class objects can be equal, which I am not sure about;
> and things would get even more exciting in, say, Bee with its
> instance-spacific behavior)?
>
> [1] https://dl.acm.org/doi/10.1145/3632869
>
>
> On Fri, Nov 29, 2024 at 02:27:32PM +0700, Luciano Notarfrancesco via
> Cuis-dev wrote:
> > 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?
>
> > --
> > Cuis-dev mailing list
> > Cuis-dev at lists.cuis.st
> > https://lists.cuis.st/mailman/listinfo/cuis-dev
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250127/600940c2/attachment.htm>


More information about the Cuis-dev mailing list