summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-12-06 23:11:23 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-05 11:40:01 +0100
commit22a9dc1b797de72ce17d24ab68ed1a7908f5f661 (patch)
tree0b82ad709089b9f64a6bbd28d35bcca126d554dd
parent3e480b17c73b4e0a86f1323cdaf2dcbbcf723df1 (diff)
downloadguix-22a9dc1b797de72ce17d24ab68ed1a7908f5f661.tar.gz
monads: Add portability to Guile 2.0.
This allows (guix monads) to be compiled and use on the current
"guile-bootstrap" package, which is Guile 2.0.9.

* guix/monads.scm (define-syntax-parameter-once): Add 'cond-expand' form.
-rw-r--r--guix/monads.scm17
1 files changed, 11 insertions, 6 deletions
diff --git a/guix/monads.scm b/guix/monads.scm
index 6924471345..d7bc98f0e0 100644
--- a/guix/monads.scm
+++ b/guix/monads.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -279,11 +279,16 @@ more optimizations."
   ;; does not get redefined.  This works around a race condition in a
   ;; multi-threaded context with Guile <= 2.2.4: <https://bugs.gnu.org/27476>.
   (eval-when (load eval expand compile)
-    (define name
-      (if (module-locally-bound? (current-module) 'name)
-          (module-ref (current-module) 'name)
-          (make-syntax-transformer 'name 'syntax-parameter
-                                   (list proc))))))
+    (cond-expand
+      ((not guile-2.2)
+       ;; The trick below doesn't work on Guile 2.0.
+       (define-syntax-parameter name proc))
+      (else
+       (define name
+         (if (module-locally-bound? (current-module) 'name)
+             (module-ref (current-module) 'name)
+             (make-syntax-transformer 'name 'syntax-parameter
+                                      (list proc))))))))
 
 (define-syntax-parameter-once >>=
   ;; The name 'bind' is already taken, so we choose this (obscure) symbol.