Opened 3 years ago
Closed 3 years ago
#1771 closed defect (fixed)
Except specificier in imports
Reported by: | Idiomdrottning | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 5.3 |
Component: | unknown | Version: | |
Keywords: | Cc: | ||
Estimated difficulty: |
Description (last modified by )
Note: this is with the patch for #1757 applied, for the future 5.3.0.
Here is the issue. If this is an egg,
cakes.scm:
(module cakes ()
(import scheme (chicken module) match-generics)
(reexport
(rename scheme (define define-og))
(rename match-generics (define-dx define))))
cakes.egg
((synopsis "A min via for import except")
(components (extension cakes)))
And here is a file that uses that egg:
(import (except cakes define))
(define (lamp x) 19)
(define (lamp x y) 21)
(+ (lamp 13 41)
(lamp 12))
The expected behavior is for this to bork or crash.
Instead it evals to 40, as if we had imported
(import (only cakes define))
Change History (10)
comment:1 Changed 3 years ago by
comment:2 Changed 3 years ago by
Description: | modified (diff) |
---|---|
Milestone: | someday → 5.3 |
comment:3 Changed 3 years ago by
Slightly simplified:
;;; my-define.scm (module my-define (define) (import (only scheme define-syntax syntax-rules) (only (chicken base) error)) (define-syntax define (syntax-rules () ((_ a b) (error "wrong define!")))))
;; reexported-my-define.scm (module reexported-my-define () (import (only my-define define) (chicken module)) (reexport (only my-define define)))
;; at REPL #;1> (import (except reexported-my-define define)) ; loading ./reexported-my-define.import.scm ... ; loading ./my-define.import.scm ... Note: re-importing already imported syntax: define ; loading ./reexported-my-define.so ... ; loading ./my-define.so ... #;2> (define a 1) Error: wrong define!
comment:4 Changed 3 years ago by
Note, this only goes wrong for macros:
;; my-display.scm (module my-display (display) (import (only scheme define) (only (chicken base) error)) (define (display x) (error "Wrong display")))
(module reexported-my-display () (import (only my-display display) (chicken module)) (reexport (only my-display display)))
;; at REPL #;1> (import (except my-display display)) ; loading ./my-display.import.scm ... ; loading ./my-display.so ... #;2> (display "hi\n") hi
comment:5 Changed 3 years ago by
I can't reproduce this on master, with or without the patch for #1757. What am I missing?
comment:6 Changed 3 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:7 Changed 3 years ago by
hm, that makes no sense; that fix should just have removed old duplicates...
comment:8 Changed 3 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Asked reporter to check, but the bug is still there. Maybe my reproduce case is too simple?
comment:9 follow-up: 10 Changed 3 years ago by
Ah, bug is fixed after all. However, I'll leave this ticket open until we've added the regression test.
comment:10 Changed 3 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Ah, bug is fixed after all. However, I'll leave this ticket open until we've added the regression test.
That's been added in commit de762521. Closing for real this time!
define is a part of the default environment, so it's always there. You can import another definition which will override it, but you can't do it without.
If you put the file using the egg inside a module, it should work as expected.