[plt-dev] Weird bug
Ya, that was the issue.
I was reproviding scheme, except for "error", but scheme provides
error at the syntax and expression phases, and I was only overriding
the expression level.
Now that I know
(except-out (all-from-out scheme) error (for-syntax error))
is legal, I have to change my mental model of provides.
Jay
On Tue, Mar 17, 2009 at 6:51 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Tue, 17 Mar 2009 16:30:35 -0600, Jay McCarthy wrote:
>> I have a planet package with a file called main that exports 'error'
>>
>> When I try to run the following module:
>>
>> #lang scheme
>> (require (planet cce/scheme:4:1/planet))
>> (require (for-label (only-in (this-package-in main)
>> error)))
>>
>> I get the following error:
>>
>> module: identifier already imported from a different source in:
>> error
>> (rename (planet plai/plai:1:0/main) error error)
>> (rename (planet plai/plai:1:0/main) error error)
>
> I can provoke this error by creating "main.ss" as
>
> #lang scheme
> (require "other.ss")
> (define-for-syntax error 5)
> (provide error
> (for-syntax error))
>
> where "other.ss" also exports `error' (at phase level 0).
>
> So, "main.ss" exports different `error' bindings at phase levels 0 and
> 1. That creates a conflict for the `for-label' import, because
> `for-label' collapses all phases, and thus ends up with two different
> `error' bindings.
>
> Is that what happens in your program?
>
>
> I see that defining "main.ss" as
>
> #lang scheme
> (define error 5)
> (define-for-syntax error 5)
> (provide error
> (for-syntax error))
>
> doesn't trigger an error, but that's a bug. The `require' form is
> apparently checking just the id and module, which is the same, but it
> should also compare the source phase levels.
>
>
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay
"The glory of God is Intelligence" - D&C 93