Hi, Mark,
Mark H Weaver <[email protected]> skribis:
> In the end, here's how this works: 'with-ellipsis' binds a special
> identifier named #{ $sc-ellipsis }# using a new 'ellipsis' binding type.
> The new ellipsis identifier is stored within the binding. In order to
> determine whether an identifier X is an ellipsis, the binding for
> #{ $sc-ellipsis }# is looked up in the lexical environment of X. If the
> binding is found and has binding-type 'ellipsis', then X is compared to
> the identifier stored in the binding using 'bound-id=?'. Otherwise, X
> is compared to '...' using 'free-id=?' as was done before.
This looks nice! Thanks for providing the detailed reasoning, that’s
insightful.
Does something like this work:
(define-syntax define-inline
(with-ellipsis ---
(syntax-rules ()
((_ (name parms ---) exp ---)
(define-syntax name
(syntax-rules ()
((_ args (--- ---))
((lambda (parms ---) exp ---)
args (--- ---)))))))))
Looks good to me for 2.0.
Could you wrap lines to 80 columns in psyntax.scm?
> +@subsubsection Specifying a custom ellipsis identifier
Should be “Specifying a Custom Ellipsis Identifier”.
> +@subsubsection Custom ellipsis identifiers for syntax-case macros
Likewise.
> + (define-syntax define-quotation-macros
> + (lambda (x)
> + (syntax-case x ()
> + ((_ (macro-name head-symbol) ...)
> + #'(begin (define-syntax macro-name
> + (lambda (x)
> + (with-ellipsis …
> + (syntax-case x ()
> + ((_ x …)
> + #'(quote (head-symbol x …)))))))
> + ...)))))
Pretty cool. :-)
Thanks,
Ludo’.