[plt-scheme] conditional module inclusion and compilation

From: YC (yinso.chen at gmail.com)
Date: Wed Sep 2 22:33:53 EDT 2009

On Wed, Sep 2, 2009 at 5:23 PM, Lee Spector <lspector at hampshire.edu> wrote:

> On Sep 2, 2009, at 7:52 PM, Eli Barzilay wrote:
>> Compiling files will save you the compilation cost so if you run long
>> processes there's no real difference.
> Good -- that's what I thought and the same as compilation in CL, but I
> didn't know if there was some other reason for creating .zo files. In the
> case of my current project compilation takes less than a second and runtimes
> will often be hours, so it's not an issue.

When you deliver the code via planet, the code gets compiled for you.

>  You have the freedom -- you can even do a reader thing similar to the
>> CL #+ -- but the default makes it harder to trip on these bugs (which
>> can get very nasty).
> Understood. Part of my attitude is probably just from being a newcomer and
> feeling, probably often out of ignorance, like it's harder to do some things
> I'm used to doing in CL (e.g. in areas like writing macros with arbitrary
> expansions, using eval, and splitting code over multiple files without
> having to think about modules). In many such cases I'm probably just wrong,
> but I do think there's more of a focus on safety in this community. This is
> probably for the good in most situations, particularly when people are
> developing large software systems that will be used by others, but it can
> also sometimes feel constraining, particularly when developing small
> experimental systems for one's own use.

It seems that if you have taken the care to abstract your OS dependent code
to separate OS specific modules (which all export the same module
signature), than conditionally requiring the modules during compile time
makes sense.

I've hacked up a planet package to support this particular usage - if you
are interested just load it via

(require (planet bzlib/os))

Which will give you macros to conditionally requiring modules, provide
modules, and evaluate arbitrary code.

See the package homepage for more details.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090902/5ecd2761/attachment.html>

Posted on the users mailing list.