guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54674] [PATCH] services: configuration: Use *unspecified* instead o


From: Maxime Devos
Subject: [bug#54674] [PATCH] services: configuration: Use *unspecified* instead of 'disabled.
Date: Fri, 01 Apr 2022 21:56:58 +0200
User-agent: Evolution 3.38.3-1

Attila Lendvai schreef op vr 01-04-2022 om 21:19 [+0200]:
+                      (if (unspecified? (syntax->datum def))
                           #`(#,name #,getter)
                           #`(#,name #,getter (default #,def))))

I'm not sure this does what you want it to do:

(define-syntax foo
  (lambda (s)
    (syntax-case s ()
      ((_ bar)
       (pk (syntax->datum #'bar) (unspecified? (syntax->datum #'bar)))))))
(foo *unspecified*)
;;; (*unspecified* #f)

The problem is that, from the macro systems POV, *unspecified* is just
a variable reference to the global *unspecified* --- *unspecified*
isn't magic to the reader, the reader just interprets it as a symbol.

Suggestion:

(define-syntax foo2
  (lambda (s)
    (syntax-case s ()
      ((_ bar)
       (pk (syntax->datum #'bar)
           (and (identifier? #'bar)
                (free-identifier=? #'*unspecified* #'bar)))))))
(foo2 *unspecified*)
;;; (*unspecified* #t)

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]