Re: Keyword arguments in procedures specified in SRFIs
Lassi Kortela 24 Jul 2019 12:34 UTC
> I tried the following test in Gauche:
> [...]
>
> According to these tests, an uninterned symbol read from a port is never
> equal to another uninterned symbol with the same name, even if the
> references are embedded in the same data structure (here, a cons cell).
Just confirmed that Gambit has the same interpretation as Gauche. Marc
already hinted at this upthread:
> Yes… but eq-ness is not preserved because a new uninterned symbol is generated for each one:
>
>> (eq? '#:foo '#:foo)
> #f
Common Lisp doesn't preserve equality either:
(setf gg (with-input-from-string
(in (let ((g (gensym)))
(with-output-to-string (out)
(write (cons g g) :stream out))))
(read in)))
(car gg) ; => #:G3010
(cdr gg) ; => #:G3010
(eq (car gg) (cdr gg)) ; => NIL
I had never realized that before.
If it turns out that #: would be a good prefix for keywords, how hard
would it be to change the uninterned symbol prefix in Gambit and Gauche?
Do users rely on the semantics of #: symbols being inequal when read
back in, considering that they probably can't do much with those symbols
if equality of references to the same gensym within the same data
structure are not preserved?