Re: apparent bug in sample implementation of SRFI 148 William D Clinger 20 Jul 2017 01:37 UTC

The mystery may not be so mysterious after all.

Marc Nieper-Wißkirchen wrote:

> I tried the following code at the repl:

(define-syntax foo
  (syntax-rules ()
    ((foo bar x)
     (define-syntax bar
       (syntax-rules (x)
         ((bar c) 'matched)
         ((bar z) 'unmatched))))))

(foo bar c)
(bar q)

> Chez, Chibi, Racket (R6RS), Larceny (R7R6, version from yesterday) all
> evaluate the last expression to matched.

I should have tested that myself.  Chibi and Sagittarius are returning
`unmatched` for me:

% chibi-scheme -V
chibi-scheme 0.7.3 "nitrogen" (chibi r7rs ...)
% chibi-scheme
>
(define-syntax foo
  (syntax-rules ()
    ((foo bar x)
     (define-syntax bar
       (syntax-rules (x)
         ((bar c) 'matched)
         ((bar z) 'unmatched))))))
> (foo bar c)
> (bar q)
unmatched

% sagittarius --version
Sagittarius scheme shell, version 0.8.4 (x86_64-pc-linux)
% sagittarius -r7
sash[r7rs]>
(define-syntax foo
  (syntax-rules ()
    ((foo bar x)
     (define-syntax bar
       (syntax-rules (x)
         ((bar c) 'matched)
         ((bar z) 'unmatched))))))
#<unspecified>
sash[r7rs]> (foo bar c)
#<unspecified>
sash[r7rs]> (bar q)
unmatched

Kawa v2.4 also returns `unmatched`.  Petite Chez returns `matched`,
however.

Will