Re: Comments on draft #3 Marc Nieper-Wißkirchen 05 Jun 2020 06:18 UTC

Have you been able to test my patch, by the way?

Am So., 3. Mai 2020 um 18:10 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@nieper-wisskirchen.de>:
>
> With the attached patch, SYNTAX-RULES macros now allow a single identifier as a top-level pattern, which matches the whole form:
>
> (define-syntax foo
>   (syntax-rules ()
>     (x (begin (display 'x) (newline)))))
>
> foo ;Expands into code that displays "foo".
>
> Am So., 3. Mai 2020 um 17:51 Uhr schrieb Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de>:
>>
>> Am So., 3. Mai 2020 um 11:06 Uhr schrieb Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de>:
>>
>> [...]
>>
>>>
>>> I bet that implementing identifier macros in any Scheme system is a
>>> work of less than one day each. Already now every Scheme system
>>> handles macro keywords, which are not in head position, (usually by
>>> throwing an error). To make it usable in systems without
>>> ER-MACRO-TRANSFORMER and SYNTAX-CASE, a top-level pattern in
>>> SYNTAX-RULES, which just consists of an identifier has to be allowed
>>> (as all other patterns won't match).
>>
>>
>> To prove that my bet is not insubstantial, I have attached a patch for the Chicken implementation of Scheme. With the patch (it may need to be polished by the maintainers of Chicken), transformers associated with keywords are now also invoked when the keyword is not in head position.
>>
>> The following example will expand `foo' into #f and display "foo" on the console.
>>
>> (define-syntax foo
>>   (er-macro-transformer
>>     (lambda (x r c)
>>       (display x)
>>       (newline)
>>       #f))
>>
>> foo
>>
>> Although I have just installed the Chicken source code, which is still alien to me, it took me less than two hours to get the thing done.  I shouldn't be a hurdle for other implementations as well.
>>
>> Marc