Subject: Re: bug#27476: libguile/memoize.c is not thread safe, so syntax parameter expansion is not thread-safe

From: Ludovic Courtès <[email-masked]>
Date: Wed, 06 Feb 2019 23:09:23 +0100

Hi!

Andy Wingo <[email-masked]> skribis:

> To be clear, here's the series of events.  Firstly, know that defining a
> syntax parameter is like:

Thanks for the clear explanation!

>> So I came up with ‘define-syntax-parameter-once’, which is like
>> ‘define-once’ but for syntax parameters (note that we can’t use
>> ‘define-once’ in ‘define-syntax-parameter-once’ because it expands to a
>> reference to NAME, which doesn’t work for a macro):
>
> Your fix is good!  But, it prevents redefinition of syntax parameters.

Yes.  It’s acceptable in this case, so I’ve pushed it as a workaround as
commit 8245bb74fc7bdcdc2f9d458057cefc9cd982e489 in Guix.

> I would like to work on a solution that instead of using this
> double-lookup, simply adds an association between P and F* in the
> environment, instead of doing the double-lookup thing.  Probably that
> will be 3.0-only.
>
> For 2.2, we can probably update the compiler to trampoline through some
> kind of "redefine-syntax" or something that will do (set-car! B F**)
> instead of (define P (stx-param B*)).  I.e. redefinition keeps the
> unique key there.

Sounds good.  Are you taking a look at this?

Perhaps that’d be a good excuse to release 2.2.5.

Thank you!

Ludo’.