﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1441	Macro keywords unexpectedly match against imported identifiers	sjamaan	sjamaan	"As reported by Joerg Wittenberger, Al Petrofsky's ""unhygienic extraction"" of identifiers via `syntax-rules` keywords list fails when the identifier was imported from another module.

A simplified example:

{{{
#!scheme
(module break (break)
  (import scheme)
  (define break ""elsewhere""))


(module unhygienic-loop (loop)
  (import scheme)

(define-syntax find-identifier
  (syntax-rules ()
    ((_ ident (x . y) sk fk)
     (find-identifier ident x sk (find-identifier ident y sk fk)))
    ((_ ident #(x ...) sk fk)
     (find-identifier ident (x ...) sk fk))
    ((_ ident form sk fk)
     (let-syntax
         ((check
           (syntax-rules (ident)
             ((_ ident ident* (s-f . s-args) fk_) (s-f ident* . s-args))
             ((_ x y sk_ fk_) fk_))))
       (check form form sk fk)))))


(define-syntax loop
  (syntax-rules ()
    ((_ . exps)
     (let-syntax
         ((l (syntax-rules ()
               ((_ ident exps_)
                (call-with-current-continuation
                 (lambda (ident)
                   (let f ()
                     (begin 'prevent-empty-begin . exps_)
                     (f))))))))
       (find-identifier break exps (l exps) (l bogus exps)))))))


(module foo ()

(import scheme break unhygienic-loop)

;; Uncomment these and comment the above to see the differing behaviour:
;; (import scheme unhygienic-loop)

;; This definition is not required
;; (define break ""local"")

(display (loop (break 'foo))))
}}}

This appears to be incorrect, at least when compared to Chibi on an equivalent set of R7RS modules, it behaves identically in the case where the identifier is defined locally, undefined, or defined by another module.

In CHICKEN 4.12 and earlier, this code behaves the same regardless of where the identifier came from."	defect	closed	major	5.1	expander	4.13.0	wontfix	hygiene, syntax-rules, capture		hard
