From: Vivien Kraus <vivien@planete-kraus.eu>
To: guile-user <guile-user@gnu.org>
Subject: Does the eval-when example work?
Date: Wed, 19 Oct 2022 22:32:33 +0200 [thread overview]
Message-ID: <d8869db4c5a3f47c70008f8b364cc3b7b58d52da.camel@planete-kraus.eu> (raw)
Dear guile users,
The manual, section 6.8.8, presents the eval-when form with an example:
(use-modules (srfi srfi-19))
(eval-when (expand load eval)
(define (date) (date->string (current-date))))
(define-syntax %date (identifier-syntax (date)))
(define *compilation-date* %date)
I take the liberty to add:
(display *compilation-date*)
(newline)
Now, when I save to test.scm and run guile -s test.scm, it gets
compiled and it displays the current date. However, if I run this
command a second time, the file is not recompiled, but the compilation
date changes. Is it intended?
If so, this is not exactly what I am looking for. I am looking for a
way to run the (date) form during the compilation phase, and save the
date to the compilation unit so that it does not change. Is this
possible?
Best regards,
Vivien
next reply other threads:[~2022-10-19 20:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 20:32 Vivien Kraus [this message]
2022-10-19 20:47 ` Does the eval-when example work? Jean Abou Samra
2022-10-22 13:26 ` Jean Abou Samra
2022-10-20 8:53 ` Maxime Devos
2022-10-21 17:41 ` Vivien Kraus
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=d8869db4c5a3f47c70008f8b364cc3b7b58d52da.camel@planete-kraus.eu \
--to=vivien@planete-kraus.eu \
--cc=guile-user@gnu.org \
/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).