Ellipsis patterns and unquote-splicing
Wolfgang Corcoran-Mathe 30 Dec 2023 02:05 UTC
Hi again,
I noticed that the SRFI's Specification section says that "An
(⟨unquote-splicing [sic] ⟨expression⟩ …) form is equivalent to
(⟨unquote⟩ ⟨expression⟩ …) ⟨ellipsis⟩". This is not true, however,
when unquote-splicing occurs in a (⟨ellipsis⟩ ⟨template⟩) form,
i.e. when ellipses are escaped. At the very least, you can't
simply translate unquote-splicing to ellipsis patterns without
checking for escapes. To avoid possible implementation bugs, I think
"... except when the unquote-splicing form occurs as a sub-template
of a (⟨ellipsis⟩ ⟨template⟩) form," or something like that, should
be appended to the sentence quoted above.
There's a slightly annoying asymmetry between ellipsis patterns and
unquote-splicing. They do very similar things, but are different in
minor ways. The ellipsis identifier can be escaped in a template, but
there's no similar escape for unquote-splicing. While it's outside the
scope of this (finished) SRFI, I wonder whether another quasiquotation
form with ellipsis patterns and *without* unquote-splicing could be
more elegant. Of course, it wouldn't be as convenient. Food for
thought, I guess.
Regards,
Wolf
P.S. There's also a missing bracket after "unquote-splicing" in
the sentence about ellipsis/unquote-splicing equivalence.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>