[plt-dev] order of module requires
On Apr 22, Jos Koot wrote:
> It appears that modules are not run in the same order as they are
> required. This can give trouble when modules have side effects, for
> instance one module writing a file and the other one reading that
> file. As an example:
>
> File module-sequence1.ss
> #lang scheme
> (printf "module 1~n")
>
> File module-sequence2.ss
> #lang scheme
> (printf "module 2~n")
>
> File module-sequence12.ss
> #lang scheme
> (require "module-sequence1.ss")
> (require "module-sequence2.ss")
> ;Displays:
> ;module 2
> ;module 1
There is another solution here besides thunks: if you want the first
module to be running first, then make the second one require it.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!