David you wrote "both" so I just wanted to point out I read three ways:

1. Units
2. Callbacks (pass the function as a parameter).
3. Lazy-requires

In a simple case (maybe yours?) I'd suggest trying 2 (callbacks)
first, and see how that works for you in practice.

Also:

4. It doesn't sound like this is your case, but: If there are many
function calls where you pass the extra parameter, and that's
annoying? Keep in mind you can use a `make-parameter` parameter. (You
can even do both, e.g. there's an optional argument, the default value
of which is the current parameter value.) Of course, that requires
some new .rkt file where you define and provide the parameter, and the
other files need to require _that_.  Whether that's a bug or a
feature, depends.

~~~

Speaking of parameters: Sometimes it can make sense for an app to have
a config.rkt where parameters are defined. Similarly-named environment
variables are read on startup. For example, as one part of a so-called
12 factor app. But this is orthogonal to what folks were discussing
above. For instance you're not going to read Racket function values
from the environment. :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to