That is not what I want. There may be other programs requiring the same module. I prefer the method of delaying execution by making required modules to do nothing else than expor procedures (or macros) and make the top level module invoke the exported/imported procedures. Now that I follow this method I no longer have any problem. This gives me full control of the order of side effects. Hence I make a distictions between top level modules and requirds modules. Non top modules must not producd side effects. They may export procedures that produce side effects, but these procedures will be called by the top level module only. (mho)
Jos

----- Original Message ----- From: "Eli Barzilay" <e...@barzilay.org>
To: "Jos Koot" <jos.k...@telefonica.net>
Cc: <plt-dev@list.cs.brown.edu>
Sent: Wednesday, April 22, 2009 5:58 PM
Subject: Re: [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!


_________________________________________________
 For list-related administrative tasks:
 http://list.cs.brown.edu/mailman/listinfo/plt-dev

Reply via email to