LilyPond has never guaranteed backward compatibility of its API between versions, except for minor versions of the same stable release. It's usually the case that between any given two versions only a small subset of code requires changes, but you should always assume that when upgrading to a new LilyPond version you may need to run convert-ly on your files.
On Sat, Feb 8, 2025 at 1:15 PM Paolo Prete <paolopr...@gmail.com> wrote: > 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 <valen...@petzel.at> 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 >