This is the mail archive of the mailing list for the Kawa project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: unquote in quasisyntax

On Feb 6, 2012, at 4:20 AM, Helmut Eller wrote:

* Per Bothner [2012-02-06 08:21] writes:

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?

R6RS semantics should be used instead of SRFI-72. Dybvig and the Racket
gang seem to write all the relevant documentation about this stuff, so
using #, is less surprising.

Another incompatibility/shortcoming when compared to R6RS/Dybvig is that
Kawa can't handle a syntax-case pattern that isn't a list with the macro
name in the first car.

For example, TSPL4 section 8.4 [1] includes a "define-integrable" macro:

(define-syntax define-integrable
  (syntax-rules (lambda)
    [(_ name (lambda formals form1 form2 ...))
       (define xname
         (let-syntax ([name (identifier-syntax xname)])
           (lambda formals form1 form2 ...)))
       (define-syntax name
         (lambda (x)
           (syntax-case x ()
             [_ (identifier? x) #'xname]
             [(_ arg (... ...))
              #'((let-syntax ([name (identifier-syntax xname)])
                   (lambda formals form1 form2 ...))
                  arg (... ...))]))))]))

and R6RS Standard Libraries section 12.4 [2] has:

(define p (cons 4 5))
    (lambda (x)
      (syntax-case x (set!)
        [(set! _ e) #â(set-car! p e)]
        [(_ . rest) #â((car p) . rest)]
        [_  #â(car p)]))))
(set! 15)                   â 15
p                       â (15 5)

A bit higher up in the section it says:

A <pattern> is an identifier, constant, or one of the following.

(<pattern> ...)
(<pattern> <pattern> ... . <pattern>)
(<pattern> ... <pattern> <ellipsis> <pattern> ...)
(<pattern> ... <pattern> <ellipsis> <pattern> ... . <pattern>)
#(<pattern> ...)
#(<pattern> ... <pattern> <ellipsis> <pattern> ...)

Admittedly I've never encountered a situation where it really mattered,
but it might come up if someone is trying to port some fancy macros from
Chez or Racket to Kawa.

[1] [2]

Jamison Hope
The PTR Group

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]