lilypond-devel
[Top][All Lists]
Advanced

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

Should we be touching goops?


From: David Kastrup
Subject: Should we be touching goops?
Date: Fri, 03 Jun 2022 02:32:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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

-- 
David Kastrup



reply via email to

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