[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should we be touching goops?

From: Jean Abou Samra
Subject: Re: Should we be touching goops?
Date: Sat, 4 Jun 2022 00:19:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

Le 03/06/2022 à 02:32, David Kastrup a écrit :
GOOPS was supposed to cause quite a performance hit with Guile 1.8 when
used extensively.  It wasn't supposed to do this with Guile 2+ so
something like this should be feasible, also for other types:

#(use-modules (oop goops))

#(define <Moment> (class-of (ly:make-moment 0)))
#(define-method (+ (a <Moment>) (b <Moment>)) (ly:moment-add a b))
#(define-method (- (a <Moment>) (b <Moment>)) (ly:moment-sub a b))

#(display (- (ly:make-moment 3) (ly:make-moment 4) (ly:make-moment 2)))

For those types where manipulation is frequent enough that we defined
arithmetic (and possibly other) operators rather than ordinary functions
in C++, there may be some point in doing the same in Scheme with

Nice! I wasn't aware that GOOPS had become faster
in Guile 2, nor even that it supported smob types.
I had stayed in the conception that it was a "don't
use" module.

I'd be in favor of doing this. It will ease writing
operations on moments and such. What other types could
use it? Moment and Duration stand as obvious candidates.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]