[racket] nested require modules and global variable

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Sun Dec 18 17:36:00 EST 2011

On Sunday, December 18, 2011, Niitsuma Hirotaka <hirotaka.niitsuma at gmail.com>
wrote:
> How about this?
> http://d.hatena.ne.jp/niitsuma/20081113/1324207362
> I add some comment
>

Ok, thanks for posting that code.

Do you expect modules to be re-invoked on every require?  I am trying to
understand your concern about "valid behavior".


The model I have with regards to modules is this: modules can be "required"
from many different modules, but they are "invoked" just once.


So I if I have files A.rkt, B.rkt, and C.rkt, which all look like this:


;; a.rkt
#lang racket
(printf "hi, this is A\n")


;; b.rkt
#lang racket
(require "a.rkt")
(printf "hi, this is B\n")


;; c.rkt
#lang racket
(require "a.rkt")
(require "b.rkt")
(printf "hi, this is C\n")


Then I expect to see the following output when I run c.rkt:

    hi, this is A
    hi, this is B
    hi, this is C

Does my expectation surprise you, or does this match what you'd expect as
well?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111218/2c2edb0e/attachment.html>

Posted on the users mailing list.