R7RS mode syntax-rules literal problem

Issue #232 resolved
Hamayama created an issue

R7RSモードでの syntax-rules の不具合報告になります。

(import (scheme base))

(define-syntax mac-main1
  (syntax-rules ()
    ((_ lit x1 y1 z1)
     (let-syntax
         ((mac-sub1
           (syntax-rules (lit)
             ((_ x2 y2 z2)
              (+ x2 y2 z2)))))
       (mac-sub1 x1 y1 z1)))))

(mac-main1 x2 1 2 3)

; => no expansion for (mac-sub1 1 2 3)

マクロで生成した literal と、pattern 変数が同名のときに展開エラーになります。

Ypsilon の syntax-rules stress test を実行してみて気が付きました。

それで、SRFI-149 参照実装の元である
https://github.com/ashinn/chibi-scheme/blob/master/lib/init-7.scm
が更新されていました。

Gauche 用モジュールでも以下のように修正しました。
https://github.com/Hamayama/srfi-149-mod/commit/ac80b9a06dbbfb7f9e007ed6dbb906b3c558f8fa

Comments (3)

  1. Log in to comment