From: Vivien Kraus <vivien@planete-kraus.eu>
To: Maxime Devos <maximedevos@telenet.be>, Guile User <guile-user@gnu.org>
Subject: Re: Control the order of expansion of syntax-case macros
Date: Fri, 20 Dec 2024 18:01:16 +0100 [thread overview]
Message-ID: <921392f0731f858b29f65b8a011693a810b96551.camel@planete-kraus.eu> (raw)
In-Reply-To: <20241220101531.qxFW2D00E2kJuzj01xFXPe@xavier.telenet-ops.be>
Hello!
Le vendredi 20 décembre 2024 à 10:15 +0100, Maxime Devos a écrit :
> (define-syntax hello
> (lambda (stx)
> (syntax-case stx ()
> (_
> (begin
> (format (current-error-port) "Hello!\n")
> (datum->syntax #f "hello"))))))
>
> You can simplify this to:
>
> (define-syntax hello
> (lambda (stx)
> (format (current-error-port) "Hello!\n")
> (datum->syntax #f "hello")))
This was an eye-opening moment for me: syntax-case is its own thing and
I don’t need the full define-syntax / lambda / syntax-case combo.
> I wonder, did you copy-paste all four blocks (both the define-syntax
> forms and the ,expand) at the same time, or one-by-one?
Oops, I was evaluating everything at once, so I did not notice the
format took place at definition time.
> Another option is to just let ‘hello’ and ‘world’ be procedure (that
> happen to accept syntax and produce syntax)
I’ll have to examine my new options now that I can think outside the
define-syntax / lambda / syntax-case box.
Anyway, thank you again for your help.
Best regards,
Vivien
next prev parent reply other threads:[~2024-12-20 17:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 16:33 Control the order of expansion of syntax-case macros Vivien Kraus
2024-12-20 9:15 ` Maxime Devos via General Guile related discussions
2024-12-20 17:01 ` Vivien Kraus [this message]
2024-12-20 10:38 ` Nala Ginrut
2024-12-20 20:12 ` Zelphir Kaltstahl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=921392f0731f858b29f65b8a011693a810b96551.camel@planete-kraus.eu \
--to=vivien@planete-kraus.eu \
--cc=guile-user@gnu.org \
--cc=maximedevos@telenet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).