summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-12-11 23:50:13 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-05 11:40:02 +0100
commitb446a604b491cf66cc818d50fa23461a37dc94a2 (patch)
treeaf1c18547f91fab0a08d4be41c7c2ddcff0c7150
parenteb8eba95dab5005c16895648b8f7c4838290d26b (diff)
downloadguix-b446a604b491cf66cc818d50fa23461a37dc94a2.tar.gz
DRAFT serialization: Avoid 'define-values', for the sake of Guile 2.0.
DRAFT: We should probably just use 'let-values' instead.

* guix/serialization.scm (define-values) [not guile-2.2]: New macro.
-rw-r--r--guix/serialization.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/guix/serialization.scm b/guix/serialization.scm
index f793feb53d..ceccd207aa 100644
--- a/guix/serialization.scm
+++ b/guix/serialization.scm
@@ -287,6 +287,21 @@ order."
          string<?)
    string=?))
 
+(cond-expand
+  ((not guile-2.2)
+   ;; Guile 2.0 lacks 'define-values'.
+   (define-syntax define-values
+     (syntax-rules ()
+       ((_ (a b) exp)
+        (begin
+          (define a #f)
+          (define b #f)
+          (call-with-values (lambda () exp)
+            (lambda (x y)
+              (set! a x)
+              (set! b y))))))))
+  (else #t))
+
 (define* (write-file-tree file port
                           #:key
                           file-type+size