Ouch, #Guile #Scheme has betrayed me

I am using Guile-GI the GObject Introspection framework for Guile, and discovered that the eq? predicate sometimes returns #t for two different symbols. Does #GOOPS allow overloading eq? on symbols such that it can return #t on different symbols? If so this seems like a huge problem to me, it completely violates the Scheme language specification. (Or should I ask, is this a “GOOPS oopsie?”)

Anyway, what happens is this: you can capture a Gtk keyboard event in an event handler, and extract the list of modifier keys pressed on that key event. It looks something like this:

(lambda (event) (let*-values (((state-ok modifiers) (event:get-state event)) ((mod-bits) (modifier-type->number modifiers)) ((first-mod) (car mod-bits))) (display "first modifier: ") (write first-mod) (newline) (display "is symbol? ") (write (symbol? first-mod)) (newline) (display "eq? to 'mod1-mask: ") (write (eq? 'mod1-mask first-mod)) (newline) #t ))

And the output of the above event handler, when I press a key with a CJK input method enabled (on latest Linux Mint) is this:

first modifier: modifier-reserved-25-mask is symbol? #t eq? to 'mod1-mask: #t

The fact that (eq? 'mod1-mask 'modifier-reserved-25-mask) when the 'modifier-reserved-25-mask has been obtained from a C-language FFI callback is a pretty bad thing to happen in a Scheme implementation, in my humble opinion.

#tech #software #Schemacs #SchemeLang #R7RS

guile-gi 0.3.2-0.388653a — Packages — GNU Guix

GObject bindings for Guile

@ramin_hal9001 Ask it on the Guile user mailing list. At least before, spk121 always replied. He isn't in Mastodon, he is in twitter https://x.com/MikeSpike3
Mike Noodle (@MikeSpike3) on X

I write incredibly uninteresting low-level software. Also transit, urbanism, and sometimes outdoor stuff.

X (formerly Twitter)
@spectrumgomas thanks, I think I might drop a quick message to Spk121 on the Guile mailing list about this.