fix: #877
compile
(use-modules)
(define (foo)
(pk 'do-things))
(define (foo)
(pk 'do-other-things))
now got
Backtrace:
In ice-9/boot-9.scm:
1784:12 14 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
13 (apply-smob/0 #<thunk 7f6df6910340>)
In ice-9/boot-9.scm:
733:2 12 (call-with-prompt _ _ #<procedure default-prompt-handle...>)
In ice-9/eval.scm:
619:8 11 (_ #(#(#<directory (guile-user) 7f6df6913c80>)))
In /nix/store/dhdkzdm8z10bkbvwngjsh2dw36yihac7-devshell-dir/bin/guild:
72:17 10 (main _)
In hoot/frontend-cli.scm:
451:22 9 (dispatch-compile _)
In ice-9/ports.scm:
439:17 8 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In hoot/compile.scm:
601:18 7 (_ _)
482:4 6 (compile _ #:imports _ #:import-abi? _ #:export-abi? _ # ...)
In hoot/library-group.scm:
908:9 5 (expand-library-group #<<library-group> src: #("hoot/c...> ...)
In srfi/srfi-1.scm:
576:18 4 (fold #<procedure program->reversed-bindings (program ...> ...)
In hoot/library-group.scm:
830:15 3 (program->reversed-bindings _ (#<<definition> name: ...> ...))
653:4 2 (module->reversed-bindings _ (library-group-program1469) ...)
603:17 1 (foldts #<tree-il (seq (define foo (lambda ((name . foo...>)
656:27 0 (_ _)
hoot/library-group.scm:656:27: duplicate top-level definition #("x.scm" 5 0) foo
While Guile (and Hoot before this PR) allows redefinitions from import (treating them as shadowing), this PR enforces strict single-definition semantics, i.e. raise errors on this situation.
(use-modules (hoot apply))
(define apply 1)
got
......
hoot/library-group.scm:656:27: duplicate top-level definition #("x.scm" 1 0) apply
I have a vague feeling this isn't the right approach, but I'm not sure what to do. I really need a reviewer's comment.
fix: #877
compile
```scheme
(use-modules)
(define (foo)
(pk 'do-things))
(define (foo)
(pk 'do-other-things))
```
now got
```
Backtrace:
In ice-9/boot-9.scm:
1784:12 14 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
13 (apply-smob/0 #<thunk 7f6df6910340>)
In ice-9/boot-9.scm:
733:2 12 (call-with-prompt _ _ #<procedure default-prompt-handle...>)
In ice-9/eval.scm:
619:8 11 (_ #(#(#<directory (guile-user) 7f6df6913c80>)))
In /nix/store/dhdkzdm8z10bkbvwngjsh2dw36yihac7-devshell-dir/bin/guild:
72:17 10 (main _)
In hoot/frontend-cli.scm:
451:22 9 (dispatch-compile _)
In ice-9/ports.scm:
439:17 8 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In hoot/compile.scm:
601:18 7 (_ _)
482:4 6 (compile _ #:imports _ #:import-abi? _ #:export-abi? _ # ...)
In hoot/library-group.scm:
908:9 5 (expand-library-group #<<library-group> src: #("hoot/c...> ...)
In srfi/srfi-1.scm:
576:18 4 (fold #<procedure program->reversed-bindings (program ...> ...)
In hoot/library-group.scm:
830:15 3 (program->reversed-bindings _ (#<<definition> name: ...> ...))
653:4 2 (module->reversed-bindings _ (library-group-program1469) ...)
603:17 1 (foldts #<tree-il (seq (define foo (lambda ((name . foo...>)
656:27 0 (_ _)
hoot/library-group.scm:656:27: duplicate top-level definition #("x.scm" 5 0) foo
```
While Guile (and Hoot before this PR) allows redefinitions from import (treating them as shadowing), this PR enforces strict single-definition semantics, i.e. raise errors on this situation.
```scheme
(use-modules (hoot apply))
(define apply 1)
```
got
```
......
hoot/library-group.scm:656:27: duplicate top-level definition #("x.scm" 1 0) apply
```
I have a vague feeling this isn't the right approach, but I'm not sure what to do. I really need a reviewer's comment.