GNU bug report logs - #76485
[PATCH] gexp: ‘with-parameters’ properly handles ‘%graft?’.

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sat, 22 Feb 2025 15:01:07 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: David Elsing <david.elsing <at> posteo.net>
Cc: 76485 <at> debbugs.gnu.org
Subject: [bug#76485] [PATCH v2] gexp: ‘with-parameters’ properly handles ‘%graft?’.
Date: Tue, 04 Mar 2025 23:09:09 +0100
[Message part 1 (text/plain, inline)]
Hello,

David Elsing <david.elsing <at> posteo.net> skribis:

> Fixes <https://issues.guix.gnu.org/75879>.
>
> * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules.
> Add state-parameterize and store-parameterize indentation rules.
> * etc/manifests/system-tests.scm (test-for-current-guix): Replace
> mparameterize with store-parameterize.
> * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise.
> * gnu/tests.scm (compile-system-test): Likewise.
> * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters.
> * guix/monads.scm (mparameterize): Remove macro.
> (state-call-with-parameters): New procedure.
> (state-parameterize): New macro.
> * guix/store.scm (store-parameterize): New macro.
> * tests/gexp.scm ("with-parameters for %graft?"): New test.
> * tests/monads.scm ("mparameterize"): Remove test.
> ("state-parameterize"): New test.
>
> Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>

Applied with the change below, in accordance with the deprecation
policy.

Thank you!

Ludo’.

PS: Let me know if I got the copyright line wrong.

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/monads.scm b/guix/monads.scm
index 0df82bb4653..e1b056dc95f 100644
--- a/guix/monads.scm
+++ b/guix/monads.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2017, 2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2013-2015, 2017, 2022, 2025 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2025 David Elsing <david.elsing <at> posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +20,7 @@
 (define-module (guix monads)
   #:use-module ((system syntax)
                 #:select (syntax-local-binding))
+  #:autoload   (guix deprecation) (warn-about-deprecation)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-9)
@@ -58,7 +60,8 @@ (define-module (guix monads)
             state-push
             state-pop
             run-with-state
-            state-parameterize))
+            state-parameterize
+            mparameterize))
 
 ;;; Commentary:
 ;;;
@@ -618,4 +621,15 @@ (define-syntax state-parameterize
            (lambda ()
              (mbegin %state-monad body ...))))))))
 
+(define-syntax mparameterize                  ;can be removed after 2026-03-05
+  (lambda (s)
+    "This is the old form for 'state-parameterize', which pretended to work
+with any monad but was in fact specialized for '%state-monad'."
+    (syntax-case s ()
+      ((_ monad bindings body ...)
+       (begin
+         (warn-about-deprecation 'mparameterize (current-source-location)
+                                 #:replacement 'state-parameterize)
+         #'(state-parameterize bindings body ...))))))
+
 ;;; monads.scm end here

This bug report was last modified 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.