[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1437: csi needs double imports
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1437: csi needs double imports |
Date: |
Sun, 07 Jan 2018 13:27:10 -0000 |
#1437: csi needs double imports
---------------------------------+---------------------------
Reporter: mario | Owner:
Type: defect | Status: new
Priority: major | Milestone: 5.0
Component: expander | Version: 5.0
Resolution: | Keywords: double import
Estimated difficulty: |
---------------------------------+---------------------------
Comment (by sjamaan):
It looks like this is happening because `(import srfi-1)` causes the
import library to be loaded and imported into the environment, but then
also causes `srfi-1.so` to be loaded, which contains `(eval '(scheme
chicken.base chicken.syntax))` since
24325e3a6e1e829e9e9be8d22e28d1711a796bd2.
This `eval` clobbers the bindings we just imported with those from
`scheme`. Because calling `(import srfi-1)` again at the REPL won't cause
the srfi-1 library's toplevel to be evaluated again, the bindings are
clobbered yet again, but this time with those from srfi-1, causing us to
actually see the intended bindings.
You can see it clearly in a DEBUGBUILD:
{{{
#;1> (import srfi-1)
; loading
/home/sjamaan/chickens/chicken-5-dbg/lib/chicken/9/srfi-1.import.so ...
; loading
/home/sjamaan/chickens/chicken-5-dbg/lib/chicken/9/chicken.import.so ...
Note: re-importing already imported identifier: assoc [this is the srfi-1
binding we asked for, srfi-1#assoc]
Note: re-importing already imported identifier: member [same]
; loading /home/sjamaan/chickens/chicken-5-dbg/lib/chicken/9/srfi-1.so ...
Note: re-importing already imported identifier: member [srfi-1 toplevel
executing, importing scheme#assoc as assoc]
Note: re-importing already imported identifier: assoc [same]
#;2> (import srfi-1)
Note: re-importing already imported identifier: assoc [and now we ask for
srfi-1#assoc again, and we get it because no new code is run]
Note: re-importing already imported identifier: member
}}}
I'm not sure about the best fix for this. We could change the ordering of
what `import` does, so that the import of the requested library is done
**after** all the dependency loading, but that's not a complete fix.
Perhaps only proper programs (not libraries) should get these `eval`
expressions injected at the toplevel?
--
Ticket URL: <https://bugs.call-cc.org/ticket/1437#comment:3>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #1437: csi needs double imports shadowed procedures, Chicken Trac, 2018/01/02
- Re: [Chicken-janitors] #1437: csi needs double imports (was: csi needs double imports shadowed procedures), Chicken Trac, 2018/01/02
- Re: [Chicken-janitors] #1437: csi needs double imports, Chicken Trac, 2018/01/06
- Re: [Chicken-janitors] #1437: csi needs double imports,
Chicken Trac <=
- Re: [Chicken-janitors] #1437: csi needs double imports, Chicken Trac, 2018/01/07
- Re: [Chicken-janitors] #1437: csi needs double imports, Chicken Trac, 2018/01/07
- Re: [Chicken-janitors] #1437: csi needs double imports, Chicken Trac, 2018/01/07
- Re: [Chicken-janitors] #1437: csi needs double imports, Chicken Trac, 2018/01/16