[racket-dev] internal-definition parsing

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Jul 8 13:56:21 EDT 2010

On Jul  8, Matthias Felleisen wrote:
> 2. I do not understand why #%body isn't enough. Couldn't #%body
>    locally expand to the point where defs and exps are
>    distinguished?

Yes, it could -- and I guess that would be in analogy to
`#%module-begin'.  But I generally don't like that macros that need to
distinguish definitions from expressions need to do that work in that
context too -- it's delicate enough that it shouldn't be left to the
"good enough" instinct of leaving partial solutions.  (In the
`#%module-begin' case, a common result of this instinct is matching on
expressions that use `define', without expanding them, or expanding
them without dealing with macros.)

> 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?

It could be the same macro with (syntax-local-context) distinguishing
the two...  It might even make sense to do so in some cases where a
similar macro is needed in both (as with the lazy case).

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.