chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different versions of syntax-rules


From: Lassi Kortela
Subject: Re: Different versions of syntax-rules
Date: Tue, 25 Apr 2023 15:07:17 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

I seem to remember that in R7RS, an underscore matches anything, which
is not entirely compatible with R5RS, where you could actually use an
underscore as a variable name.

That seems correct. I can find the underscore rule in neither R5RS nor SRFI 46, but it is present in R6RS and R7RS.

Besides that one nitpick, I'd be fine with copying it over to core.

Here's the diff (with `diff -uw`, ignoring whitespace differences): https://misc.lassi.io/2023/chicken-synrules.diff

It looks like the changes are light.

Of particular note is that the R7RS code adds this:

+   ;; R7RS support: underscore matches anything
+   (define (underscore? x)
+     (c x (r '_)))

If you wish to support the R5RS semantics where underscore isn't special, this procedure could check some kind of state variable saying which flavor of syntax-rules to use. `underscore?` could always return #f unless the R7RS version is in use.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]