From 22a9dc1b797de72ce17d24ab68ed1a7908f5f661 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Dec 2019 23:11:23 +0100 Subject: 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. --- guix/monads.scm | 17 +++++++++++------ 1 file 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 +;;; Copyright © 2013, 2014, 2015, 2017, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -279,11 +279,16 @@ (define-syntax-rule (define-syntax-parameter-once name proc) ;; does not get redefined. This works around a race condition in a ;; multi-threaded context with Guile <= 2.2.4: . (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. -- cgit v1.2.3