From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Abou Samra Newsgroups: gmane.lisp.guile.bugs Subject: bug#58646: [PATCH] doc: Fix eval-when example Date: Wed, 19 Oct 2022 23:04:06 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16265"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 To: 58646@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Oct 19 23:06:44 2022 Return-path: Envelope-to: guile-bugs@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 1olGGx-00041a-Iw for guile-bugs@m.gmane-mx.org; Wed, 19 Oct 2022 23:06:43 +0200 Original-Received: from localhost ([::1]:44214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olGGw-00070R-1M for guile-bugs@m.gmane-mx.org; Wed, 19 Oct 2022 17:06:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olGFL-0006yT-Nm for bug-guile@gnu.org; Wed, 19 Oct 2022 17:05:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olGFL-0000jH-5F for bug-guile@gnu.org; Wed, 19 Oct 2022 17:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1olGFK-0005BS-JM for bug-guile@gnu.org; Wed, 19 Oct 2022 17:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jean Abou Samra Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 19 Oct 2022 21:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58646 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166621346219874 (code B ref -1); Wed, 19 Oct 2022 21:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Oct 2022 21:04:22 +0000 Original-Received: from localhost ([127.0.0.1]:60310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olGEg-0005AU-4C for submit@debbugs.gnu.org; Wed, 19 Oct 2022 17:04:22 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olGEb-0005AJ-GU for submit@debbugs.gnu.org; Wed, 19 Oct 2022 17:04:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olGEa-0005YD-3L for bug-guile@gnu.org; Wed, 19 Oct 2022 17:04:16 -0400 Original-Received: from mout.kundenserver.de ([217.72.192.73]:59417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olGEY-0000IX-5w for bug-guile@gnu.org; Wed, 19 Oct 2022 17:04:15 -0400 Original-Received: from [10.188.149.104] ([46.193.67.184]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.184]) with ESMTPSA (Nemesis) id 1M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it97UZhZCCZckUa+W+q 1tZ0LzgUR1O5L0+MhwQ7qHMahulTjJ6wiTqeJ0hpNuZPyxfaqdYzsYoei5LzHztRAV7akxwt Received-SPF: none client-ip=217.72.192.73; envelope-from=jean@abou-samra.fr; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10407 Archived-At: From 0e35d0494b7c6f05819e3386d404776a64a2e5c9 Mon Sep 17 00:00:00 2001 From: Jean Abou Samra Date: Wed, 19 Oct 2022 23:01:06 +0200 Subject: [PATCH] doc: Fix eval-when example * doc/ref/api-macros.texi: make the macro expand to the literal   date, not to a call to the date function.  The example previously   did not actually need eval-when and did not show the intended   effect. ---  doc/ref/api-macros.texi | 25 ++++++++++++++++---------  1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi index cdb33df31..ed7bbe763 100644 --- a/doc/ref/api-macros.texi +++ b/doc/ref/api-macros.texi @@ -1236,14 +1236,19 @@ But if a syntactic definition needs to call out to a normal procedure at  expansion-time, it might well need need special declarations to indicate that  the procedure should be made available at expansion-time. -For example, the following code will work at a REPL, but not in a file: +For example, the following code tries to embed a compilation timestamp +in the compiled bytecode using a macro that expands to the date as +string literal.  It will work at a REPL, but in a file, it cannot be +byte-compiled.  @example -;; incorrect  (use-modules (srfi srfi-19)) -(define (date) (date->string (current-date))) -(define-syntax %date (identifier-syntax (date))) -(define *compilation-date* %date) +(define start-date (date->string (current-date))) +(define-syntax *compilation-date* +  (lambda (sintax) +    start-date)) +(display *compilation-date*) +(newline)  @end example  It works at a REPL because the expressions are evaluated one-by-one, in order, @@ -1253,12 +1258,14 @@ evaluated until the compiled file is loaded.  The fix is to use @code{eval-when}.  @example -;; correct: using eval-when  (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) +  (define start-date (date->string (current-date)))) +(define-syntax *compilation-date* +  (lambda (sintax) +    start-date)) +(display *compilation-date*) +(newline)  @end example  @deffn {Syntax} eval-when conditions exp... -- 2.37.3