[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: G-Expressions and Scope Preservation
From: |
Ludovic Courtès |
Subject: |
Re: G-Expressions and Scope Preservation |
Date: |
Wed, 22 Jan 2020 23:22:35 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hello!
Chris Marusich <address@hidden> skribis:
> In your paper "Code Staging in GNU Guix" [1], you use the following
> example to illustrate how G-Expressions are hygienic ("they preserve
> lexical scope across stages"):
>
> (let ((gen-body (lambda (x)
> #~(let ((x 40))
> (+ x #$x)))))
> #~(let ((x 2))
> #$(gen-body #~x)))
>
> You explain that it expands to something like this:
>
> (let ((x-1bd8-0 2))
> (let ((x-4f05-0 40))
> (+ x-4f05-0 x-1bd8-0)))
>
> However, when I write this gexp to disk, it doesn't look like that:
Ah ha! That bit is still in the ‘wip-gexp-hygiene’ branch.
The reason I haven’t merged it, other than I didn’t take the time, is
that the output depends on Guile’s ‘hash’ function, which is not
necessarily stable. Actually, it changed between 2.0 and 2.2, but I
think it’s the same in 2.2 and 3.0. This needs to be checked, because
if it differs, then people will get different results depending on the
Guile version they use, and that’d be a serious issue.
I thought I had mentioned this before, but apparently not:
https://lists.gnu.org/archive/html/guix-devel/2017-07/msg00181.html
https://lists.gnu.org/archive/html/guix-devel/2017-09/msg00093.html
We should also do some more testing to make sure nothing breaks.
Ludo’.