[Top][All Lists]

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

Re: define-module, #:export and export

From: Maxime Devos
Subject: Re: define-module, #:export and export
Date: Fri, 6 Jan 2023 14:55:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

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


Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

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