Re: \set Score.proportionalNotationDuration warning on LilyPond 2.25.23

Paolo Prete <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.devel,gmane.comp.gnu.lilypond.general
Message-ID <CA+Xftr99hAG31tGLb06ss855=i1gjJLCar4GrEe_z_wrUqRbSQ@mail.gmail.com>
Thanks Valentin, I will definitely use it in my code.
But this API change leaves me a bit perplexed. It's the first one I've
encountered since LilyPond 2.19.84! For this reason I am crossposting
this message with the devel mailing list.
Why has forward compatibility not been ensured for this function?




Il sab 8 feb 2025, 17:42 Valentin Petzel <[email protected]> ha scritto:

> Hello Paolo,
>
> > Is there a way to make this snippet compatible with all LilyPond
> > versions starting from 2.19.84?
>
> You could do something like this
>
> ```
> requireVersion =
> #(define-scheme-function (version then else)
>    (string? scheme? scheme?)
>    (define (list< x y)
>      (if (null? x)
>          #f
>          (cond ((< (car x) (car y)) #t)
>                ((> (car x) (car y)) #f)
>                (else (list< (cdr x) (cdr y))))))
>    (let* ((split (string-split version #\.))
>           (nversion (map string->number split))
>           (tversion (ly:version)))
>      (if (list< tversion nversion)
>          else
>          then)))
>
> {
>   \set Score.proportionalNotationDuration = \requireVersion "2.25.23"
> #1/32
> #(ly:make-moment 1 32)
>   c' c' c'
> }
> ```
>
> to set a different value depending on the Lilypond version.
>
> Cheers,
> Valentin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.