[racket-dev] internal-definition parsing

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Jul 8 11:19:36 EDT 2010

On Jul 7, 2010, at 5:55 PM, Eli Barzilay wrote:

> Some examples that show how useful this is:
> 
>  * In the lazy language you want the implicit begin to force all
>    expressions except for the last one.
> 
>  * I've redefined the implicit begin (in an ugly way) for my course
>    language to force all non-tail expressions to have a `Void' type.
> 
>  * The scribble/text language should really return a list of all
>    values instead of just the last one.  It currently provides `text'
>    that builds on `begin/collect', which allows each block of
>    consecutive definitions to be mutually recursive -- this is now a
>    problem in that it's different in a subtle way than the default
>    implicit begin.
> 
> I think that a good goal is to have all of these uses available as
> simple macro definitions.
> 
> If you take the lazy use as an example, then just a single `#%body'
> thing is not enough: since it needs to force only expressions, then
> having a `#%body' means that it will need to do its own crawling over
> the expressions to find which ones are not definitions and force
> them.  So it looks like another special #% macro would be needed, and
> even that is not enough to implement the last one conveniently, since
> it needs to collect all non-definition expressions and combine them.


1. Three distinct examples (plus Algol, which could benefit too) sound like enough. 

2. I do not understand why #%body isn't enough. Couldn't #%body locally expand to the point where defs and exps are distinguished? 

3. Also, I am beginning to wonder whether the right name is #%block-begin of #%body-begin 

4. The next thing to consider is whether #%module-begin and #%block-begin are truly separate features. In a sense, we now should say that modules are just bodies. Or is there a difference? 

-- Matthias





Posted on the dev mailing list.