Loris  Check-in [efb39c9699]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Document this confusing procedure
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:efb39c9699b38a181e525d825074fb1cadfe9659
User & Date: jesper 2016-04-16 12:09:48
Context
2016-04-18
09:34
Rework the version library again. All exports use strings for version numbers. Remove version juggling outside of the version library. There are now 3 exported procedures, VERSION, FEATURE-VERSION and ASSERT. VERSION is called without arguments and will evaluate to the Loris library version. (version) -> "2.1.0-devel" FEATURE-VERSION may be called with zero or one argument. Called with no arguments, it evaluates to the Loris MAJOR.MINOR version. If an argument is supplied, it will be used instead of the Loris library version string. (feature-version) -> "2.1" (feature-version "1.2.3-alpha+build.2" -> "1.2" ASSERT takes one argument, interprets it as a version number string, and throws an error iff a program written for that specific version of the Loris library will not be compatible with the current Loris version. Otherwise, the program is assumed to be compatible with the current Loris version, and the current Loris library is returned. In the follow examples, the Loris version is assumed to be "2.1.0-devel.2" (assert "2.1.0-alfa") -> "2.1.0-devel" (assert "2.1.0-devel") -> "2.1.0-devel" (assert "2.1.0-devel.2") -> ERROR (assert "2.1.0") -> ERROR (assert "1.8.4") -> ERROR (assert "2.0.0") -> ERROR (assert "2.10.0") -> "2.1.0-devel" check-in: 17bd3b2314 user: jesper tags: trunk
2016-04-16
12:09
Document this confusing procedure check-in: efb39c9699 user: jesper tags: trunk
11:30
I guess these changes warrant another year on the (c) line. check-in: 832dae9274 user: jesper tags: trunk
Changes

Changes to version.scm.

59
60
61
62
63
64
65









66
67
68
69
70
71
72

    (define (version-number</compare-two a b)
      (cond ((and (number? a) (not (number? b))) #t)
            ((and (not (number? a)) (number? b)) #f)
            ((and (number? a) (number? b)) (< a b))
            (else (string< a b))))










    (define (semantic-version</compare-two a-list b-list)
      (let check ((a a-list)
                  (b b-list))
        (cond ((null? b) #f)
              ((null? a) #t)
              ((version-number< (car a) (car b)) #t)
              ((version-number< (car b) (car a)) #f)







>
>
>
>
>
>
>
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

    (define (version-number</compare-two a b)
      (cond ((and (number? a) (not (number? b))) #t)
            ((and (not (number? a)) (number? b)) #f)
            ((and (number? a) (number? b)) (< a b))
            (else (string< a b))))

    ;; This procedure is unaware of how (list 1 0 0 "beta") is lower
    ;; than (list 1 0 0) according to semver.org. Therefore, it should
    ;; not be exposed outside of this library.
    ;;
    ;; The procedure compatible? uses this procedure (through
    ;; semantic-version<) to compare the cdr of the full semantic
    ;; version. However, this is done only after the eventuality of
    ;; only one of the two versions having a pre-release tag has
    ;; been handled.
    (define (semantic-version</compare-two a-list b-list)
      (let check ((a a-list)
                  (b b-list))
        (cond ((null? b) #f)
              ((null? a) #t)
              ((version-number< (car a) (car b)) #t)
              ((version-number< (car b) (car a)) #f)