guile-devel
[Top][All Lists]
Advanced

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

Re: A lexical use-modules?


From: Maxime Devos
Subject: Re: A lexical use-modules?
Date: Tue, 29 Mar 2022 16:59:06 +0200
User-agent: Evolution 3.38.3-1

Maxime Devos schreef op za 26-03-2022 om 20:21 [+0100]:
> (define-syntax use-module/lexical
>   ;; todo: integrate into (use-modules ...)?
>   (lambda (s)
>     (syntax-case s ()
>       ((_ foo)
>        (let* ((module-name (syntax->datum #'foo))
>               (interface (resolve-interface module-name)))
>          (define (binding->import name variable)
>            (define name-syntax (datum->syntax s name))
>            #`(define-syntax #,name-syntax (identifier-syntax (@ foo
> #,(datum->syntax #'irrelevant name)))))
>          #`(begin #,@(module-map binding->import interface)))))))

This probably does not interact perfectly with 'syntax-parameterize',
'bound-identifier=?'/'free-identifier=?' and 'syntax-local-binding',
though I guess it is good enough for most practical purposes.

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]