Re: SRFI 200: Pattern Matching
Marc Nieper-WiÃkirchen 27 Jun 2020 08:05 UTC
If you prefer clear and maintainable code for the reference
implementations, I would like to recommend my SRFI 148, which allows
writing complicated syntax-rule macros much more clearly. It has
`em-symbol?', `em-bound-identifier=?', and `em-free-identifier=?'.
Marc
Am Sa., 27. Juni 2020 um 01:13 Uhr schrieb Panicz Maciej Godek
<xxxxxx@gmail.com>:
>
>
>
> sob., 27 cze 2020 o 01:02 Panicz Maciej Godek <xxxxxx@gmail.com> napisał(a):
>>
>>
>>
>> sob., 27 cze 2020 o 00:56 Alex Shinn <xxxxxx@gmail.com> napisał(a):
>>>
>>> On Sat, Jun 27, 2020 at 7:41 AM Panicz Maciej Godek <xxxxxx@gmail.com> wrote:
>>>>
>>>>
>>>> I tried to analyze the implementation of Alex Shinn's code, but I didn't manage to figure out how he recognizes that a pattern variable is an identifier.
>>>
>>>
>>> It uses Oleg's trick. See match-check-identifier.
>>>
>> I saw it. I just didn't get it ;)
>>
>
>
> OK, I get it now. The macro expands to a local macro definition (sym?). So if it is a literal (like a number or a boolean or a string), then the "successful" pattern will contain that literal, and the attempt to match it with "abracadabra" will fail.
>
> "One weird trick".
>