guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

09/10: DRAFT serialization: Avoid 'define-values', for the sake of Guile


From: guix-commits
Subject: 09/10: DRAFT serialization: Avoid 'define-values', for the sake of Guile 2.0.
Date: Sun, 5 Jan 2020 05:51:32 -0500 (EST)

civodul pushed a commit to branch wip-system-bootstrap
in repository guix.

commit b446a604b491cf66cc818d50fa23461a37dc94a2
Author: Ludovic Courtès <address@hidden>
Date:   Wed Dec 11 23:50:13 2019 +0100

    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.
---
 guix/serialization.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/guix/serialization.scm b/guix/serialization.scm
index f793feb..ceccd20 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]