home.social

#goops — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #goops, aggregated by home.social.

  1. 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