Summary
Indirect exports with (export (foo bar)) style are not working
Metadata
- Id: ff1fa9c7e3b29724eb1ca6417374c59f4fec092e
- Trac id: 1494
- Type: defect
- Reporter: megane
- Owner:
- Cc:
- Status: closed
- Component: compiler
- Estimated difficulty: hard
- Resolution: invalid
- Priority: major
- Milestone: 5.1
- Version: 5.0.0
- Changetime: 2018-08-02 13:54:49 UTC
- Created: 2018-08-02 10:38:03 UTC
- Keywords: modules
Description
(module
m
() ;; ((foo bar)) works here
(import scheme)
(cond-expand
(chicken-5 (import (chicken base) (chicken module)))
(else (import chicken)))
(define (bar) 1)
(export (foo bar))
(define-syntax foo
(ir-macro-transformer
(lambda (e inj cmp)
'(bar)))))
(import m)
(print (foo))
;; $ csi -qbn macroexport.scm
;;
;; Warning: indirect export of unknown binding in module `m': bar
;;
;; Error: unbound variable: bar
;;
;; Call history:
;;
;; <syntax> (lambda (e inj cmp) (quote (bar)))
;; <syntax> (##core#lambda (e inj cmp) (quote (bar)))
;; <syntax> (##core#begin (##core#quote (bar)))
;; <syntax> (##core#quote (bar))
;; <eval> (ir-macro-transformer (lambda (e inj cmp) (quote (bar))))
;; <syntax> (##core#undefined)
;; <eval> (##sys#load-library (##core#quote library))
;; <eval> (##sys#load-library (##core#quote library))
;; <syntax> (import m)
;; <syntax> (##core#begin (##core#undefined))
;; <syntax> (##core#undefined)
;; <syntax> (print (foo))
;; <syntax> (foo)
;; <syntax> (bar300)
;; <eval> (print (foo))
;; <eval> (bar300) <--
Changes and comments
[2018-08-02 12:51:29 UTC] kooda wrote:
The documentation for the (export) form explicitly states that “An export must precede its first occurrence (either use or definition).”
It works fine in this case, just move your export declaration above bar’s definition.
[2018-08-02 13:54:49 UTC] megane changed status from new to closed
[2018-08-02 13:54:49 UTC] megane set resolution to invalid
[2018-08-02 13:54:49 UTC] megane wrote:
You are totally right. I'm not thinking..