unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Does the eval-when example work?
@ 2022-10-19 20:32 Vivien Kraus
  2022-10-19 20:47 ` Jean Abou Samra
  2022-10-20  8:53 ` Maxime Devos
  0 siblings, 2 replies; 5+ messages in thread
From: Vivien Kraus @ 2022-10-19 20:32 UTC (permalink / raw)
  To: guile-user

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



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

end of thread, other threads:[~2022-10-22 13:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 20:32 Does the eval-when example work? Vivien Kraus
2022-10-19 20:47 ` 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

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).