[plt-scheme] Defining a transformation time path, or setting module-language to something useful

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Jun 24 14:15:50 EDT 2009

On Wed, Jun 24, 2009 at 5:17 PM, Eli Barzilay<eli at barzilay.org> wrote:
> On Jun 24, Noel Welsh wrote:
>> I'm trying to set the module-language syntax property so I can
>> recognise imports in a particular language. [...]
> The intention of this property is to provide properties about the
> language, not about the actual module code.

I wasn't very clear in my original post. I think I do want to use
model-language, and I do use syntax/module-reader, so I'll svn up and
take a look at it.

The use is this:

Abstractly, I want to recognise when a module is written in a
particular language, so that modules written in that same language can
handle requires specially.

Concretely, I'm writing a Javascript module system, reusing PLT's
module system. A JS module provides a single binding called 'script'
containing all the JS code. I don't actually care about this binding
in other JS modules -- it's only there to facilitate testing and
introspection. The result I do care about is that, as a side effect of
evaluating the module, all the JS code is stashed in a registry that I
can later inspect (and dump to file, minimise, etc.) So I want a JS
file that requires another JS file to transparently wrap that require
to rename that 'script' binding so it doesn't clash with the module's
own binding. To do so I need to able to tell if a module is written in
the JS language, so using module-language seems appropriate.


Posted on the users mailing list.