unquote in quasisyntax

Per Bothner per@bothner.com
Mon Feb 6 08:22:00 GMT 2012


I just realized we have a slight compatibility problem.

Kawa has long supported (quasisyntax FORM) and the abbreviation #`FORM.
To unquote, you would use (unquote FORM) or the abbreviation ,FORM.
This is consistent with SRFI-72, but it is not consistent with most
syntax-case implementations, including R6RS and Racket (MzScheme).
These instead use (unsyntax FORM) or #,FORM.

So it seems like Kawa should support (unsyntax FORM) and #,FORM.

As a further complication, #, was bound to the SRFI-10 feature
for named special types.  For example:
   #,(namespace "http://w3.org")

So what I've implemented is now
(1) #,FORM is mapped to (unsyntax FORM) if (lexically) within a #`FORM;
otherwise it is mapped to the SRFI-10 named type.
(2) While expanding a quasiquote, both old and new forms are recognized:
Both old: (unquote FORM) or ,FORM and new: (unsyntax FORM) or #,FORM.
However, the old form emits a warning that this syntax is deprecated.

I'm thinking maybe the deprecation warning is inapproporiate, given
that using unquote/comma *is* the specified way to do it according to
SRFI-72 (and Chicken).

Perhaps the cleanest solution is warn about the old unquote syntax
*unless* srfi-72 is explicitly requested, with a require or import.
Or perhaps that is overkill?  How many would like Kawa to really
support SRFI-72?

Note Kawa already supports perhaps the most interesting feature
of SRFI-72, which few other Scheme implementations do: A syntax
object representing a list *is* a list: list? returns true, and
you can call car and cdr on it.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list