[plt-scheme] Attaching modules to namespaces in compiled code

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Mon Jan 26 11:47:25 EST 2009

On 1/26/09 1:46 PM, Matthew Flatt wrote:
> For example, suppose you have
>
>    ;; stay.ss
>    #lang scheme
>    (printf "staying\n")
>    (define result 'double)
>    (provide result)
>
>    ;; go.ss
>    #lang scheme
>    (printf "going\n")
>    (define result 'trouble)
>    (provide result)
>
>    ;; letmeknow.ss
>    #lang scheme
>    (require scheme/runtime-path)
>
>    (define-runtime-module-path s "stay.ss")
>    (define-runtime-module-path g "go.ss")
>
>    (let loop ()
>      (case (read)
>        [(cool-it) (dynamic-require s 'result)]
>        [(blow) (dynamic-require g 'result)]
>        [else (loop)]))
>
> Then,
>
>   1) An empty `only-in' is needed because "stay.ss" and "go.ss" both
>      supply `result'.
>
>   2) Using `for-label' avoids printing "staying" or "going" until after
>      stdin supplies either "cool-it" or "blow".

I seems I forgot about both the identifier conflicts and module body 
execution. All is clear now, thanks for the patience. :)

-- 
regards,
Jakub Piotr Cłapa


Posted on the users mailing list.