[plt-dev] Rationale for kernel-form-identifier-list

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Aug 11 13:50:49 EDT 2009

At Tue, 11 Aug 2009 13:16:58 -0400, Carl Eastlund wrote:
> The kernel-form-identifier-list function from syntax/kerncase is
> useful for head expansion and similar low-level macro hackery, but its
> specifications is somewhat quirky.  It leaves out (module-)top-level
> forms (module, #%plain-module-begin, #%require, and #%provide), and
> includes the non-fully-expanded form letrec-syntaxes+values.  Is there
> a compelling reason for this?  Local (usually head-)expansion in
> internal definition contexts doesn't need the extra bindings, but I
> don't see that it would hurt to include them.  However, local
> expansion in a module context does need the extra bindings, so it
> would help to add them (and I don't see that we need a separate
> binding for it).
> As for letrec-syntaxes+values, if it gets expanded away, I don't see
> why it's in the list at all.  If it doesn't, it should be included in
> the "Fully Expanded Programs" grammar.

I can't think of a reason to leave out the module top-level forms. I'm
not sure why they were left out, and when I've thought about it in the
past, I didn't see a good reason to leave them out. So, let's add them.

The `letrec-syntaxes+values' form is special in that it appears in the
result of `local-expand', even with an empty stop list. More generally,
it's the core form for local compile-time bindings. I'll fix the docs.

Posted on the dev mailing list.