[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] ANN: first draft of R7RS small language available

On Fri, 22 Apr 2011, Alex Shinn wrote:

On Fri, Apr 22, 2011 at 7:46 AM, Andre van Tonder <andre@x> 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))
        ((_ ((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)
Scheme-reports mailing list