unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Skyler Ferris via Guix-patches via <guix-patches@gnu.org>
To: Philip McGrath <philip@philipmcgrath.com>, 70065@debbugs.gnu.org
Cc: Katherine Cox-Buday <cox.katherine.e+guix@gmail.com>,
	Liliana Marie Prikler <liliana.prikler@gmail.com>,
	Andrew Tropin <andrew@trop.in>
Subject: [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
Date: Tue, 02 Apr 2024 14:55:04 +0000	[thread overview]
Message-ID: <9c25eacc-4c7b-4b8d-99cf-4435301ae9f4@protonmail.com> (raw)
In-Reply-To: <4cef86be-421e-4010-939b-5640764fcf3e@philipmcgrath.com>

On 3/31/24 13:17, Philip McGrath wrote:
>> The loko.scm file was not recompiled so it searched chez.scm for a
>> variable named chez-scheme-for-system, which is now a syntax
>> transformer. But compiled files have already completed the expansion
>> phase, so this means that a syntax transformer is invalid. This will not
>> cause a problem for `guix pull` because guix rebuilds itself from
>> scratch when it gets updated.
>>
>
> On 3/31/24 10:35, Skyler Ferris wrote:
>   > I haven't worked with define-deprecated before. It's a macro, and I know
>   > that the guile compiler misses recompiling macro dependencies sometimes,
>   > so maybe it was a problem on my end with having mismatching build
>   > artifacts.
>
> Very interesting! I hadn't realized that problem with dependency
> tracking existed: it might explain some issues I've struggled to
> reproduce in the past. It's also given me several surprises about
> Guile's implementation of phases: for one thing, apparently
> (define-syntax x 42) expands to (define x (make-syntax-transformer 'x
> 'macro 42)). I wouldn't have expected a macro to create a value that
> would exist at runtime.
Exists yes, but it (should not be) used/referenced at runtime. I'm going 
to type some more details in case you are interested, but an important 
disclaimer is that my understanding comes from reading documentation on 
an as-needed basis and doing some work writing macros, but not a lot. I 
haven't worked with the code that actually implements these things.

I'm not sure how other schemes implement this, but Guile has a clearly 
defined separation between "compile time" and "load time". Compilation 
is when syntax transformers are used to modify source expressions into 
the expanded form (in addition to other things, like lowering to 
intermediate representations). This is discussed in the documentation 
for eval-when (1). If I define that macro and then use it within the 
same file, the place where it is used will not contain a reference to 
the syntax transformer: it will already be expanded. If I write a new 
file tomorrow which wants to use that macro, Guile will reference the 
compiled version of the module. If the syntax transformer was not 
present in the compiled module then the new file would break. Instead, 
the syntax transformer still exists in the compiled version of the file 
so that the new module can load it at expansion time. But again, once 
the new file is compiled the reference to the macro will disappear. So 
it exists at runtime, but it is only used when compiling code. For 
compiled files, it is not used at runtime. The exception is that when 
code is evaluated at the REPL, or if auto-compilation is disabled, there 
is no practical difference between compile time and load time.

I'm not entirely sure why the compiler doesn't see the dependency here. 
The section on compilation (2) says "Guile does not yet do proper 
dependency tracking" so I assume that it just hasn't been high priority 
enough for anyone to fix it. There would be trade-offs in some cases. In 
this case it is pretty easy to see that the file needs to be recompiled 
because loko.go (the compiled version of the file) contains an explicit 
reference to the macro, because it used to be a procedure. But if it was 
a macro both before and after the change the reference would not be 
there. We could add the list of macros used during compilation as 
metadata to the file but I don't know how much bloat that would cause. 
We could also reference the use-module forms in the original source, but 
I'm not sure if those are typically available in the go files or if that 
would also need to be tracked as additional metadata.

(1) https://www.gnu.org/software/guile/manual/html_node/Eval-When.html
(2) https://www.gnu.org/software/guile/manual/html_node/Compilation.html





  reply	other threads:[~2024-04-02 14:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
2024-03-29  5:18 ` [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9 Philip McGrath
2024-03-30 14:31   ` Skyler Ferris via Guix-patches via
2024-03-29  5:18 ` [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12 Philip McGrath
2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
2024-03-30 22:10     ` Philip McGrath
2024-03-29  5:18 ` [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions Philip McGrath
2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
2024-03-29  5:18 ` [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
2024-03-30  7:56   ` Liliana Marie Prikler
2024-03-30 14:39   ` Skyler Ferris via Guix-patches via
2024-03-30 22:49     ` Philip McGrath
2024-03-31 14:35       ` Skyler Ferris via Guix-patches via
2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
2024-03-31 20:17         ` Philip McGrath
2024-04-02 14:55           ` Skyler Ferris via Guix-patches via [this message]
2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 1/8] gnu: zuo: Update to 1.9 Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12 Philip McGrath
2024-04-09  8:46             ` Efraim Flashner
2024-04-11 10:44               ` Ludovic Courtès
2024-04-11 12:34                 ` Efraim Flashner
2024-04-01  6:51           ` [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions Philip McGrath
2024-04-01 15:40             ` Liliana Marie Prikler
2024-04-02  3:59               ` Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 4/8] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 5/8] gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system Philip McGrath
2024-04-01 15:41             ` Liliana Marie Prikler
2024-04-01  6:51           ` [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
2024-04-01 15:45             ` Liliana Marie Prikler
2024-04-02  3:59               ` Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 8/8] gnu: chez-scheme: Bootstrap from source Philip McGrath
2024-04-11 10:55           ` bug#70065: [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Ludovic Courtès
2024-03-29  5:18 ` [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
2024-03-30 14:40   ` Skyler Ferris via Guix-patches via
2024-03-29  5:18 ` [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source Philip McGrath
2024-03-30 14:41   ` Skyler Ferris via Guix-patches via
2024-03-30 14:28 ` [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Skyler Ferris via Guix-patches via

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://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c25eacc-4c7b-4b8d-99cf-4435301ae9f4@protonmail.com \
    --to=guix-patches@gnu.org \
    --cc=70065@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=cox.katherine.e+guix@gmail.com \
    --cc=liliana.prikler@gmail.com \
    --cc=philip@philipmcgrath.com \
    --cc=skyvine@protonmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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