[racket-dev] Module metadata

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Apr 19 17:46:10 EDT 2011

At Tue, 19 Apr 2011 17:02:30 -0400, Carl Eastlund wrote:
> I would like to associate metadata with a module based on its
> expansion.  [...] We
> currently have various metadata associated with modules, such as the
> #:info and #:language-info options in syntax/module-reader, but those
> come from the reader.  The metadata is constructed prior to expansion.

I think there should be a way to communicate post-expansion information
to `module->language', but there isn't at the moment. The result that
`module->language' extracts is based on a 'module-language property on
the expanded `module' form. Since you can't replace the `module'
expander, however, there's no way to adjust that property as a result
of expanding a module body. But I think there could and should be
something way of communicating from the body to the `module' expander
so that it updates the 'module-language property; I'll look into adding
something.


Longer term, I think a better solution is to generalize the one file ->
one module constraint that we currently have. For example, if you
attach a giant S-expression as a `module->language' property, then the
giant S-expression is loaded any time that the module declaration is
loaded. It would be better to split out the pieces so that parts could
be loaded separately --- maybe even arranging that a module's
compile-time code doesn't have to be loaded if only the run-time code
is needed. That's on the list of things that I plan to look at this
summer.



Posted on the dev mailing list.