mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-15 03:15:09 -05:00
deprecation: Add 'define-deprecated/alias'.
* guix/deprecation.scm (define-deprecated/alias): New macro.
This commit is contained in:
parent
6185732390
commit
1b7dd99738
1 changed files with 21 additions and 1 deletions
|
@ -20,7 +20,7 @@ (define-module (guix deprecation)
|
|||
#: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 @@ (define-syntax variable
|
|||
(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)))))
|
||||
|
|
Loading…
Reference in a new issue