Menu

#5067 Add lilypond version predicates/operators

Verified
Enhancement
2017-04-03
2017-02-10
Urs Liska
No

Add lilypond version predicates/operators

This set of predicates/operators compares a given reference version
to the LilyPond version that is currently being executed.
This makes it possible to implement "version switches" to write
(library) code that is compatible over syntax changes.

NOTE: I'm not sure where (and if) this should be documented.
Please make suggestions

http://codereview.appspot.com/317270043

Related

Issues: #5067

Discussion

1 2 > >> (Page 1 of 2)
  • Urs Liska

    Urs Liska - 2017-02-10

    Some example code for the feature:

    %%%%
    \version "2.19.54"
    
    #(ly:message "LilyPond > 2.19.5? ~a" (lilypond>? "2.19.5"))
    
    #(cond
      ((lilypond>? '(2 18))
       (ly:message "Running development version"))
      ((lilypond=? '(2 18))
       (ly:message "Running latest stable version"))
      (else (ly:message "Running ancient version")))
    
    functionSwitch =
    #(define-void-function (parser location)()
       (if
        (lilypond>? "2.19.21")
        (ly:parser-include-string "#(display \"Included string\")")
        (ly:parser-include-string parser "#(display \"Included string\")")))
    
    \functionSwitch
    %%%
    

    Of course this will not actually work with older versions because they
    don't have the functions
    built in. But it serves to demonstrate the use case for future syntax
    changes

    Am 10.02.2017 um 09:04 schrieb Urs Liska:


    [issues:#5067]
    https://sourceforge.net/p/testlilyissues/issues/5067/ Add lilypond
    version predicates/operators

    Status: Started
    Created: Fri Feb 10, 2017 08:04 AM UTC by Urs Liska
    Last Updated: Fri Feb 10, 2017 08:04 AM UTC
    Owner: nobody

    Add lilypond version predicates/operators

    This set of predicates/operators compares a given reference version
    to the LilyPond version that is currently being executed.
    This makes it possible to implement "version switches" to write
    (library) code that is compatible over syntax changes.

    NOTE: I'm not sure where (and if) this should be documented.
    Please make suggestions

    http://codereview.appspot.com/317270043


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/testlilyissues/issues/5067/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

    --
    ul@openlilylib.org
    https://openlilylib.org
    http://lilypondblog.org

     

    Related

    Issues: #5067


    Last edit: Urs Liska 2017-02-10
  • Anonymous

    Anonymous - 2017-02-10
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2017-02-10

    Passes, make make check and a full make doc.

     
  • Anonymous

    Anonymous - 2017-02-14
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2017-02-14

    Patch on countdown for February 17th.

     
  • Urs Liska

    Urs Liska - 2017-02-14
     
    • Urs Liska

      Urs Liska - 2017-02-14

      Stub for trying out the functions:

      #(format #t ">: ~a\n" (version-compare? '(2 19 5) = '(2 18 0)))

      It should work with all combinations of operators and combinations of
      list lengths

       

      Last edit: Urs Liska 2017-02-14
  • Anonymous

    Anonymous - 2017-02-14
    • Needs: -->
    • Patch: new --> countdown
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2017-02-14

    Passes make, make check and a full make doc.

     
  • Urs Liska

    Urs Liska - 2017-02-15

    Lexicographic comparison and ly:version? wrapper

    http://codereview.appspot.com/317270043

     
  • Urs Liska

    Urs Liska - 2017-02-15

    Test code for latest patch set:

    #(format #t "Three elements (current version 2.19.54):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2 19 54))
       (ly:version? >= 2 19 54)
       (ly:version? = 2 19 54)
       (ly:version? <= 2 19 54))
    
    #(format #t "Three elements (future version 2.19.57):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2 19 57))
       (ly:version? >= 2 19 57)
       (ly:version? = 2 19 57)
       (ly:version? <= 2 19 57))
    
    #(format #t "Three elements (earlier version 2.19.10):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2 19 10))
       (ly:version? >= 2 19 10)
       (ly:version? = 2 19 10)
       (ly:version? <= 2 19 10))
    
    #(format #t "Two elements (2 19):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2 19))
       (ly:version? >= 2 19)
       (ly:version? = 2 19)
       (ly:version? <= 2 19))
    
    #(format #t "Two elements (2 18):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2 18))
       (ly:version? >= 2 18)
       (ly:version? = 2 18)
       (ly:version? <= 2 18))
    
    #(format #t "Two elements (2 20):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2 20))
       (ly:version? >= 2 20)
       (ly:version? = 2 20)
       (ly:version? <= 2 20))
    
    #(format #t "One element (2):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(2))
       (ly:version? >= 2)
       (ly:version? = 2)
       (ly:version? <= 2))
    
    #(format #t "One element (3):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(3))
       (ly:version? >= 3)
       (ly:version? = 3)
       (ly:version? <= 3))
    
    #(format #t "One element (1):\n> : ~S, >= : ~S\n= : ~S, <= : ~S\n"
       (ly:version? > '(1))
       (ly:version? >= 1)
       (ly:version? = 1)
       (ly:version? <= 1))
    
     
  • Anonymous

    Anonymous - 2017-02-15
    • Needs: -->
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2017-02-15

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2017-02-17
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2017-02-17

    Patch on countdown for February 20th.

     
  • Urs Liska

    Urs Liska - 2017-02-18

    Rename secondary function after discussion

    http://codereview.appspot.com/317270043

     
  • Urs Liska

    Urs Liska - 2017-02-18

    Fix omission of previous patch set

    http://codereview.appspot.com/317270043

     
  • Anonymous

    Anonymous - 2017-02-18
    • Needs: -->
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2017-02-18

    passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2017-02-20

    Leaving this on review, David has some comment in Rietveld.

     
    • Urs Liska

      Urs Liska - 2017-02-20

      Am 2017-02-20 14:30, schrieb pkx166h:

      Leaving this on review, David has some comment in Rietveld.

      This is not necessary. David's last comments crossed with my patch set 4
      where I took back my doubts about the naming. In fact I had renamed the
      function to David's original suggestion.

       
  • Urs Liska

    Urs Liska - 2017-02-21

    Limit ly:version? to number list (as suggested by Paul)

    http://codereview.appspot.com/317270043

     
  • Anonymous

    Anonymous - 2017-02-21
    • Needs: -->
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2017-02-21

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2017-02-23
    • Patch: review --> countdown
     
1 2 > >> (Page 1 of 2)