[racket] Defining a typed language

From: Konrad Hinsen (konrad.hinsen at fastmail.net)
Date: Fri Oct 31 05:57:10 EDT 2014

Sam Tobin-Hochstadt writes:

 > The rule is that for anything like:
 > 
 > (module m lang
 >   (form ...))
 > 
 > `form` is expanded until it either produces `#%plain-module-begin` or
 > another core form. In the former case, it just continues, in the
 > latter case, it wraps the whole thing with `#%module-begin` as
 > exported from the specified language, and then expands that.
 > 
 > In your particular example, it will expand (displayln (foo 42)) to
 > (#%app displayln (foo 42)) and then to (#%module-begin (#%app
 > displayln (foo 42))).
 > 
 > > Are they part of the language definition? More specifically, I am
 > > looking for a way to override them.
 > 
 > I'm not sure exactly what you want to override here.

Whatever it takes to prevent the partial expansion to end in
#%plain-module-begin. I just want to get rid of the special treatment
for single-form modules. For my mini-language, I expect single-form
modules to be frequent special cases. Right now they fail
systematically because of the special treatment.

Konrad.

Posted on the users mailing list.