[plt-dev] syntax/module-reader and #%module-begin

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Nov 30 13:29:39 EST 2009

On Mon, Nov 30, 2009 at 11:14 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> Modules have this weird property: they behave differently if they have
> exactly one element in their body, than if they have zero elements, or
> two or more elements.  They expand that body element looking for
> #%module-begin.  If they have zero, or two or more, elements, they
> wrap those elements in #%module-begin.  The #%module-begin form does
> "most of the work" of expanding modules, so in the one-element-only
> case, there is a period of expansion during which #%module-begin is
> "not at the helm".  I bring this up because it caused a problem for
> Stevie (resulted in a bug report about #lang scheme/signature, in the
> case where a module contains precisely one form that is a use of
> "contracted").
> Most of our #langs are written with syntax/module-reader, which reads
> in a bunch of forms and wraps them in (module foo lang <FORM> ...).
> The problem above would go away if instead it wrapped the forms in
> (module foo lang (#%module-begin <FORM> ...)).  The only thing this
> gives up is the ability to fill in a custom #%module-begin, but... who
> does that, and why would one?

I'm not sure I understand. But I have a custom #%module-begin that
does expansion and compilation in the Web languages. I believe that TS
does that too.


> Is it sensible to change syntax/module-reader to do this?  Or if not
> in general, is it worth adding a "#:add-module-begin" flag to
> syntax/module-reader to individual language authors can choose this
> behavior without having to implement it?
> Carl Eastlund
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-dev

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the dev mailing list.