Re: [Scheme-reports] ANN: first draft of R7RS small language available
Andre van Tonder 22 Apr 2011 16:40 UTC
On Fri, 22 Apr 2011, Alex Shinn wrote:
> On Fri, Apr 22, 2011 at 7:46 AM, Andre van Tonder <andre@het.brown.edu> wrote:
>>
>> Yes, it must be the same binding. Otherwise nested QUASIQUOTE will break.
>
> If we don't explicitly require that they are the same binding,
> and an implementation chooses to _not_ make them the
> same binding, then it must come up with some way to make
> quasiquote work. It can choose to use the Chibi/Chicken
> approach, or it can use a macro implementation which can
> match the nested quasiquote with the actual identifier the
> form was expanded from, or it can make quasiquote match
> itself unhygienically.
No, but that QUASIQUOTE macro /itself/ must work portably across
modules, otherwise a lot of people are going to be unhappy.
It is a plain syntax-rules macro that was portable Scheme before
for many years since R5RS.
It does not use anything questionable or strange
or implementation-specific.
It also stands for a large number of other macros in the Scheme
corpus using similar techniques. I don't think it will be
acceptable to tell people that macros like
this won't be portable any longer and may need one
of the hacks that you are suggesting.
(define-syntax quasiquote
(syntax-rules (unquote unquote-splicing quasiquote)
((_ (unquote form))
form)
((_ ((unquote-splicing form) . rest))
(append form (quasiquote rest)))
((_ (quasiquote form) . depth)
(list 'quasiquote (quasiquote form #f . depth)))
((_ (unquote form) x . depth)
(list 'unquote (quasiquote form . depth)))
((_ (unquote-splicing form) x . depth)
(list 'unquote-splicing (quasiquote form . depth)))
((_ (car . cdr) . depth)
(cons (quasiquote car . depth) (quasiquote cdr . depth)))
((_ #(elt ...) . depth)
(list->vector (quasiquote (elt ...) . depth)))
((_ atom . depth)
'atom)))
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports