Another possible use of define-auxiliary-syntax
Marc Nieper-WiÃkirchen 24 Aug 2020 15:31 UTC
On the mailing list of SRFI 197, for the chain macro defined by SRFI
197, Arne asked about arbitrary positional parameters "_0", "_1",
..."_9" as auxiliary syntax.
The limit of 10 positional parameters is, of course, somewhat
arbitrary but any hygienic syntax-rules implementation has to have
some limitations because only a finite number of predefined
identifiers can be matched literally.
For a more powerful macro system, however, an unlimited number of
parameters "_0", ... "_99", ..., "_666", ... is possible for a macro
in conjunction with SRFI 206:
The user of the macro imports the needed parameters from the magic
library (srfi 206 *). The macro itself, which wants to match these,
may have to create these on the fly for comparison. For this,
"define-auxiliary-syntax" is used.
Note that this not a full solution yet. The problem is that the macro
in question has to be able to detect whether an argument is an
argument of the "_?". Otherwise, it is not clear how many placeholders
have to be created on the fly. Another primitive that allows
introspection of auxiliary syntax seems to be necessary. I welcome any
suggestion that doesn't stretch the usual expansion system.