This is the mail archive of the kawa@sourceware.org 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 ...))
     (begin
       (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))
(define-syntax p.car
  (make-variable-transformer
    (lambda (x)
      (syntax-case x (set!)
        [(set! _ e) #â(set-car! p e)]
        [(_ . rest) #â((car p) . rest)]
        [_  #â(car p)]))))
(set! p.car 15)
p.car                   â 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] http://www.scheme.com/tspl4/syntax.html#./syntax:h4 [2] http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-13.html#node_sec_12.4

--
Jamison Hope
The PTR Group
www.theptrgroup.com




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