[racket] TR - Require of a struct: defined in a submodule in a submodule.

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue Aug 28 12:27:18 EDT 2012

On Tue, Aug 28, 2012 at 12:23 PM, Eric Dobson <eric.n.dobson at gmail.com> wrote:
> Possibly, how is it not working for you?
>
> With:
> #lang typed/racket/base
>
> (module mytypes racket/base
>
>   (provide  S)
>
>   (struct S ()))
>
> (module tyuser racket/base
>
>   (require
>    (submod ".." mytypes))
>
>   (define (mkS value)
>     (S)))
>
> (note submodules are now in plain racket)
>
>
> I get:
> tmp.rkt:17:5: link: module mismatch;
>  possibly, bytecode file needs re-compile because dependencies changed
>   importing module: 'tyuser
>   exporting module: 'tmp
>   exporting phase level: 0
>   internal explanation: variable not provided (directly or indirectly)
>   at: make-S
>   in: make-S.1
>   context...:
>    /Users/endobson/proj/racket/plt/collects/compiler/cm.rkt:308:0: compile-zo*
>    /Users/endobson/proj/racket/plt/collects/compiler/cm.rkt:508:26
>    /Users/endobson/proj/racket/plt/collects/compiler/cm.rkt:501:42
>    /Users/endobson/proj/racket/plt/collects/compiler/cm.rkt:466:0:
> maybe-compile-zo
>    /Users/endobson/proj/racket/plt/collects/compiler/cm.rkt:579:2: do-check
>    /Users/endobson/proj/racket/plt/collects/compiler/cm.rkt:653:4
>    /Users/endobson/proj/racket/plt/collects/compiler/commands/make.rkt:77:8:
> for-loop
>    /Users/endobson/proj/racket/plt/collects/compiler/commands/make.rkt:
> [running body]
>    /Users/endobson/proj/racket/plt/collects/raco/raco.rkt: [running body]
>    /Users/endobson/proj/racket/plt/collects/raco/main.rkt: [running body]
>
> Which looks like a bug in TR handling of submodules.

I believe that this is a bug in Racket, although I'm not sure.  You
can see a simpler example here:
http://drdr.racket-lang.org/25284/collects/tests/typed-racket/succeed/internal-typed-submod.rkt

>
> On Tue, Aug 28, 2012 at 7:32 AM, Ray Racine <ray.racine at gmail.com> wrote:
>> The following does not work.  Bug?
>>
>> #lang typed/racket/base
>>
>> (module mytypes typed/racket/base
>>
>>   (provide
>>    (struct-out S))
>>
>>   (struct: S ()))
>>
>> (module tyuser typed/racket/base
>>
>>   (require
>>    (submod ".." mytypes))
>>
>>   (: mkS (Any -> S))
>>   (define (mkS value)
>>     (S)))
>>
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users



-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.