summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-01-21 15:30:14 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-21 23:09:55 +0100
commit1b7dd99738f17d3e3ebc29500bc475f9dd214ba3 (patch)
tree2407b84476f1d5245177ce82d9fca4bc4bd746d6
parent6185732390003ca36a730231bb6280b68c37ee8e (diff)
downloadguix-1b7dd99738f17d3e3ebc29500bc475f9dd214ba3.tar.gz
deprecation: Add 'define-deprecated/alias'.
* guix/deprecation.scm (define-deprecated/alias): New macro.
-rw-r--r--guix/deprecation.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/guix/deprecation.scm b/guix/deprecation.scm
index 453aad7106..8d9e42758d 100644
--- a/guix/deprecation.scm
+++ b/guix/deprecation.scm
@@ -20,7 +20,7 @@
   #:use-module (guix i18n)
   #:use-module (ice-9 format)
   #:export (define-deprecated
-            without-deprecation-warnings
+            define-deprecated/alias
             deprecation-warning-port))
 
 ;;; Commentary:
@@ -87,3 +87,23 @@ This will write a deprecation warning to DEPRECATION-WARNING-PORT."
                    (id
                     (identifier? #'id)
                     #'real))))))))))
+
+(define-syntax-rule (define-deprecated/alias deprecated replacement)
+  "Define as an alias a deprecated variable, procedure, or macro, along
+these lines:
+
+  (define-deprecated/alias nix-server? store-connection?)
+
+where 'nix-server?' is the deprecated name for 'store-connection?'.
+
+This will write a deprecation warning to DEPRECATION-WARNING-PORT."
+  (define-syntax deprecated
+    (lambda (s)
+      (warn-about-deprecation 'deprecated (syntax-source s)
+                              #:replacement 'replacement)
+      (syntax-case s ()
+        ((_ args (... ...))
+         #'(replacement args (... ...)))
+        (id
+         (identifier? #'id)
+         #'replacement)))))