lilypond-devel
[Top][All Lists]
Advanced

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

Re: Should we be touching goops?


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

David Kastrup <dak@gnu.org> writes:

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

Putting a bit more meat on what this may mean:

<https://gitlab.com/lilypond/lilypond/-/merge_requests/1404>

-- 
David Kastrup



reply via email to

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