[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] hygienic named let

From: felix winkelmann
Subject: Re: [Chicken-users] hygienic named let
Date: Tue, 2 Sep 2008 09:08:48 +0200

On Mon, Sep 1, 2008 at 7:02 PM, Jim Ursetto <address@hidden> wrote:
> But it is imported.  foo imports scheme and uses named let, baz
> imports foo, therefore the expanded call to bar should see letrec via
> foo's import environment.

As I said, the `letrec' introduced by named let is special.

> As I said, I modified the expander to stop handling named let (and let
> in general) specially, and made LET a macro in the
> default-macro-environment (which works fine).  I appended that code to
> my original message.  LETREC is also contained in that environment.
> So why doesn't it work there?

Because `let' is handled specially. That's just how it is implemented.

> It doesn't work in my er-transformer version of let I posted.
> I don't understand why let needs to be handled specially, can you
> explain?  Like I said, I stripped out the special let handling code in
> ##sys#expand-0 and made let a regular er-transformer macro, and it
> works perfectly fine -- I can even recompile Chicken with it.  The
> problem is that renames don't seem to work properly inside it.  If you
> use ##core#app and ##core#letrec renames don't come into play, so why
> is the special handling required in the first place?

I assume the reason here is that the core macros don't carry a complete
static syntax-environment, as compared to user-defined ones.
It would probably work if you generalize all special forms to syntax,
but the initial macro-environment is not equivalent to the macro-
environment of a normal module. Additionally, non-module toplevel
code still has to work so there are subtle differences in the ways
syntax and core forms interact. I invite you to build with DEBUGBUILD=1
and run csi/chicken with -:d, which will give you reams of debug-output
to ponder about. Unfortunately I don't have the time right now to
figure out why a modified version of the base expander does something
weird, when the current one seems to work. I also don't know how exactly
you modified the expander, so perhaps you should send me a patch?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]