guile-user
[Top][All Lists]
Advanced

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

Does the eval-when example work?


From: Vivien Kraus
Subject: Does the eval-when example work?
Date: Wed, 19 Oct 2022 22:32:33 +0200
User-agent: Evolution 3.46.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]