[Cuis-dev] Thoughts about symbols
Boris Shingarov
shingarov at labware.com
Mon Jan 27 02:41:14 PST 2025
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
More information about the Cuis-dev
mailing list