[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #1441: Macro keywords unexpectedly match against impo
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #1441: Macro keywords unexpectedly match against imported identifiers |
Date: |
Mon, 15 Jan 2018 21:09:03 -0000 |
#1441: Macro keywords unexpectedly match against imported identifiers
-------------------------------------+-------------------------------------
Reporter: sjamaan | Owner: sjamaan
Type: defect | Status: new
Priority: major | Milestone: someday
Component: expander | Version: 4.13.0
Keywords: hygiene, syntax-rules, | Estimated difficulty: hard
capture |
-------------------------------------+-------------------------------------
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:
{{{
(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.
--
Ticket URL: <https://bugs.call-cc.org/ticket/1441>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #1441: Macro keywords unexpectedly match against imported identifiers,
Chicken Trac <=