From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vivien Kraus Newsgroups: gmane.lisp.guile.user Subject: Does the eval-when example work? Date: Wed, 19 Oct 2022 22:32:33 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37304"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.46.0 To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Oct 19 22:33:20 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olFkd-0009YU-UU for guile-user@m.gmane-mx.org; Wed, 19 Oct 2022 22:33:19 +0200 Original-Received: from localhost ([::1]:53322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olFkc-0001H4-PA for guile-user@m.gmane-mx.org; Wed, 19 Oct 2022 16:33:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olFkD-0001GZ-8Q for guile-user@gnu.org; Wed, 19 Oct 2022 16:32:53 -0400 Original-Received: from planete-kraus.eu ([2a00:5881:4008:2810::309]:46308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1olFkA-0003fJ-K3 for guile-user@gnu.org; Wed, 19 Oct 2022 16:32:52 -0400 Original-Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 5568cc52 for ; Wed, 19 Oct 2022 20:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:date:content-type :content-transfer-encoding:mime-version; s=dkim; bh=bj8GJ2E3chrj 9mYUoYh5sIdW78g=; b=X3XseQd0KmJT3vdAmD3KL9uEeuhghO0T0qfw39P7bs2L nCoCTkgTZQxwJJQFCM8OOc8RmbCxvsftBJgOAKr3ff/rHj4qYllAQFKwHo5FR6wG kt7XndD//mmKBL095icJ/Xg+1sE/ThttP/skXIjO/8LVgXwsTh51hhss2Fl+lsw= Original-Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id 94f2c3ce (TLSv1.3:AEAD-CHACHA20-POLY1305-SHA256:256:NO) for ; Wed, 19 Oct 2022 20:32:36 +0000 (UTC) Received-SPF: pass client-ip=2a00:5881:4008:2810::309; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18664 Archived-At: 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