On 06-01-2023 14:31, yarl baudig wrote:

That is also my understanding, confirmed by

$ cat lib.scm
(define-module (lib)
    #:export (test))

(define-syntax test
    (lambda (sintax)
      (syntax-case sintax ()
        ((test id)
         (datum->syntax sintax (free-identifier=? #'id #'thing))))))
[...]


Thank you both. I am trying to process this. I (re-)read 6.8 Macros and read tspl4. I don't understand why you use "datum->syntax" > I heard your suggestion. I am only trying to grasp things for now. I
realize I don't know enough (on guile and on guix) to go on a concrete goal yet.
I need to work more on this in order to understand but I wanted to thank you 
for answering that quickly!
free-identifier=? returns a boolean. However, the return value of the clauses of the syntax-case must be a syntax object. Hence Jean converted the boolean into a syntax form with datum->syntax (IIUC).

Guile's implementation of macros is a little lax with typing,
in the sense that objects like #false and #true (but not symbols, because hygiene) can be returned too, but IIUC this is undocumented and not standard Scheme (*).

(*): unverified

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to