[racket-dev] `cond' / `when' / `unless' / etc bodies

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Mon Oct 11 17:40:23 EDT 2010

On Mon, Oct 11, 2010 at 2:10 PM, Joe Marshall <jmarshall at alum.mit.edu> wrote:
> On Mon, Oct 11, 2010 at 9:59 AM, Neil Toronto <neil.toronto at gmail.com> wrote:
>> If I get a vote, +1/2 from me.
>> My vote isn't +1 because I'd rather see a syntactic restriction removed:
>> make the inside of a `begin' an internal definition context. Then the change
>> would happen in every similar macro at once.
>> Would it break much?
> BEGIN is overloaded as a `splicing' macro.  When you have a single macro call
> that needs to expand into multiple `actions', you return the actions
> within a BEGIN,
> and they are `flattened' into the containing context.  Automagically
> introducing a
> new scope would break this behavior.
> It might be a good idea to introduce some sort of specific
> macro-splicing special form.

"begin" is already context-sensitive: as an expression, it expects a
sequence of expressions; at the top-level or in a module, it expects a
sequence of definitions mixed with expressions; and in internal
definition contexts, it expects a sequence of definitions followed by
a sequence of expressions.  It would presumably not be that hard to
just change the first case, so that as an expression it introduces a
new scope and accepts definitions, while in the other cases it splices
into an existing scope.


Posted on the dev mailing list.