unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to use-modules within macro?
@ 2019-08-29 14:41 pelzflorian (Florian Pelz)
  2019-08-29 23:04 ` Mark H Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: pelzflorian (Florian Pelz) @ 2019-08-29 14:41 UTC (permalink / raw)
  To: guile-user

Hello,

I am writing a Guile macro to manipulate Scheme code and am stuck on
what I hope is a simple problem and it would be nice if you could
explain.  I try:

(define-syntax O
  (lambda (x)
    (syntax-case x ()
      ((_)
       #`(begin (use-modules (ice-9 local-eval))
                (local-eval 42 (the-environment)))))))
(pk (O))

But it does not work; it cannot resolve local-eval and
the-environment.  Why?  When I write it in the interpreter, a second
call to (pk (O)) works and prints 42.

Using (@ (ice-9 local-eval) …) does not work for looking up
the-environment.

Regards,
Florian



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-09-04 22:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-29 14:41 How to use-modules within macro? pelzflorian (Florian Pelz)
2019-08-29 23:04 ` Mark H Weaver
2019-08-30  6:47   ` pelzflorian (Florian Pelz)
2019-09-04 11:24   ` pelzflorian (Florian Pelz)
2019-09-04 19:54     ` Mark H Weaver
2019-09-04 21:55       ` Mark H Weaver
2019-09-04 22:58       ` pelzflorian (Florian Pelz)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).