[racket] Order of executing required modules

From: Jos Koot (jos.koot at telefonica.net)
Date: Tue Apr 5 11:37:22 EDT 2011

I have thought of using dynamic require, but the extra work as you
explained, make me avoid dynamic require.
Another solution would be to make a shell script that runs each test module
at OS level. However, I hate shell scripts and its more than a decade that I
wrote my last one. I always work from within DrScheme. It is very user
friendly. And with the automatic compile option, you don't have to loose
compilation time each time you invoke the same module. In short: Racket is
great!
Thanks, Jos 

> -----Original Message-----
> From: robby.findler at gmail.com 
> [mailto:robby.findler at gmail.com] On Behalf Of Robby Findler
> Sent: 05 April 2011 17:21
> To: Jos Koot
> Cc: users
> Subject: Re: [racket] Order of executing required modules
> 
> FWIW, you also have to make sure that any module that requires your
> test module does not also require one of the sub test modules as that
> could also mess up the order (but I'm sure that you don't in this
> case).
> 
> What I generally do in a situation like this (where I have a bunch of
> test files like you do) is to use dynamic-require, eg:
> 
> (define test-modules '("a.rkt" "b.rkt")) ;; etc
> (for ((x (in-list test-modules)))
>   (printf "running tests in ~a\n" x)
>   (dynamic-require x #f))
> 
> and perhaps even catch exceptions to continue running tests if some of
> them fail.
> 
> But dynamic-require doesn't transmit its dependency information to the
> compiler, so building an executable would have to be told explicitly
> which files to include to make those dynamic-requires work.
> 
> Robby
> 
> On Tue, Apr 5, 2011 at 10:17 AM, Jos Koot 
> <jos.koot at telefonica.net> wrote:
> > That's clear. My test modules do not require any other test 
> module and
> > export nothing.
> > Lesson learned: modules that are required by other ones 
> should not produce
> > side effects that may alter the behaviour of another 
> required module. Well,
> > I never did so, but it is good to be aware of it. I expect 
> that the top
> > level module of a program may rely on side effects of sub 
> level modules (as
> > for example in a module defining a new language and 
> read-table for a module
> > using this language)
> > Thanks, Jos
> >
> >> -----Original Message-----
> >> From: robby.findler at gmail.com
> >> [mailto:robby.findler at gmail.com] On Behalf Of Robby Findler
> >> Sent: 05 April 2011 16:57
> >> To: Jos Koot
> >> Cc: users
> >> Subject: Re: [racket] Order of executing required modules
> >>
> >> I don't think that there is any particular reason for that specific
> >> order, but there is a reason not to rely on any order. 
> Specifically,
> >> if you ever get one of those other files requiring each other, then
> >> this will disrupt the order you see. For example, if both 
> test-a.rkt
> >> and test-z.rkt require test-l.rkt, then test-l.rkt will run before
> >> either of them.
> >>
> >> Robby
> >>
> >> On Tue, Apr 5, 2011 at 9:49 AM, Jos Koot
> >> <jos.koot at telefonica.net> wrote:
> >> > Hi
> >> > Consider:
> >> >
> >> > File all-tetst.rkt
> >> > #lang scheme
> >> > (require "test-a.rkt")
> >> > (require "test-b.rkt")
> >> > (require "test-c.rkt")
> >> > (require "test-d.rkt")
> >> > ...
> >> > (require "test-z.rkt")
> >> >
> >> > It appears that the tests are done in reverse order, id est
> >> from z to a in
> >> > stead from a to z. Not really a problem for me, but it
> >> could be for modules
> >> > that produce side effects (for example, one writing a file,
> >> the other one
> >> > reading it) I wonder: is there a specific reason for the reversed
> >> > invokations of the required modules? Or should I use
> >> another manner for
> >> > running the tests in a specific order?
> >> >
> >> > Thanks, Jos
> >> >
> >> > _________________________________________________
> >> >  For list-related administrative tasks:
> >> >  http://lists.racket-lang.org/listinfo/users
> >> >
> >
> >




Posted on the users mailing list.