#goops — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #goops, aggregated by home.social.
-
Ouch, #Guile #Scheme has betrayed meI am using Guile-GI the GObject Introspection framework for Guile, and discovered that the
eq?predicate sometimes returns#tfor two different symbols. Does #GOOPS allow overloadingeq?on symbols such that it can return#ton 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: #tThe fact that
(eq? 'mod1-mask 'modifier-reserved-25-mask)when the'modifier-reserved-25-maskhas been obtained from a C-language FFI callback is a pretty bad thing to happen in a Scheme implementation, in my humble opinion. -
Ouch, #Guile #Scheme has betrayed meI am using Guile-GI the GObject Introspection framework for Guile, and discovered that the
eq?predicate sometimes returns#tfor two different symbols. Does #GOOPS allow overloadingeq?on symbols such that it can return#ton 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: #tThe fact that
(eq? 'mod1-mask 'modifier-reserved-25-mask)when the'modifier-reserved-25-maskhas been obtained from a C-language FFI callback is a pretty bad thing to happen in a Scheme implementation, in my humble opinion. -
Ouch, #Guile #Scheme has betrayed meI am using Guile-GI the GObject Introspection framework for Guile, and discovered that the
eq?predicate sometimes returns#tfor two different symbols. Does #GOOPS allow overloadingeq?on symbols such that it can return#ton 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: #tThe fact that
(eq? 'mod1-mask 'modifier-reserved-25-mask)when the'modifier-reserved-25-maskhas been obtained from a C-language FFI callback is a pretty bad thing to happen in a Scheme implementation, in my humble opinion. -
Ouch, #Guile #Scheme has betrayed meI am using Guile-GI the GObject Introspection framework for Guile, and discovered that the
eq?predicate sometimes returns#tfor two different symbols. Does #GOOPS allow overloadingeq?on symbols such that it can return#ton 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: #tThe fact that
(eq? 'mod1-mask 'modifier-reserved-25-mask)when the'modifier-reserved-25-maskhas been obtained from a C-language FFI callback is a pretty bad thing to happen in a Scheme implementation, in my humble opinion. -
📘 Le panda, c’est caca
Le livre le plus dangereux que vous offrirez cette année.
Un livre qui peut sauver la planète ! (rien que ça)Mais surtout… ne lisez jamais la page 8.
(Vraiment. On vous aura prévenus.)Un ovni drôle, impertinent, explosif.
Le genre de livre qu’on offre « pour les enfants »…
et qu’on garde précieusement pour soi.👉 Disponible ici : https://laboutiquedesmutins.org/le-panda-c-est-caca.html
Bonne chance !
#livre #humour #satire #goops #nouveauté #nouveaulivre #lecturedujour #enviedelire #panda
-
CW: Thoughts on Java vs Common Lisp
Having programmed in Kawa for over a year now, and having programmed in Guile for some time before, I have some thoughts regarding #Java vs Common #Lisp.
I haven't used Java all that much, and Common Lisp even less, but I think that Guile's #GOOPS system is similar to #CLOS - and likewise, the OO system in Kawa literally is that of Java.
I remember the time when I was making set of GUI widgets for my humanoid robot pose editor. I was using GOOPS for that, and I feel that it was a total mess. Well, it did work, but I don't want to go back to that code.
I was using GOOPS in many other ways, for example - to overload various math operations for matrices and quaternions. The code I wrote back then can still be admired, say, here:
https://github.com/panicz/slayer/blob/master/guile-modules/extra/math.scm
I think it was today that I got enlightened on what I really didn't like about the GOOPS/CLOS approach with generic and multimethods. It may seem like extremely flexible system, but I think that multimethods combined with subclasses are a terrible idea in practice.
Suppose that we have a base class <A>
(define-class <A> ())
(define a (make <A>))and its two subclasses:
(define-class <B> (<A>))
(define b (make <B>))(define-class <C> (<A>))
(define c (make <C>))Now, suppose that I also have a generic method:
(define-method (m (x <A>) (y <A>)) 'aa)
and its two specializations
(define-method (m (x <B>) (y <A>)) 'ba)
(define-method (m (x <A>) (y <C>)) 'ac)
Now, what is going to happen when I invoke
(m b c)
?
I checked it with Guile, and it chose the 'ba implementation. I don't know if that's because it was defined earlier, or because the method specialization is defined to be resolved from left to right - and frankly, I don't care.
Imagine that one programmer wrote the 'ac implementation and had some working code. Now, if another programmer comes and defines the 'ba variant, they would break the existing code. And this is the fundamental problem.
-
Speaking of GOOPS, I just tried the Guile GI hello world application, and now it works! 👍
(@luis_felipe eagerly dusts an archived application project, disregarding the fact that he doesn't have time for new projects).