guile-devel
[Top][All Lists]
Advanced

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

Re: Anything better for delayed lexical evaluation than (lambda () ...)?


From: Mark H Weaver
Subject: Re: Anything better for delayed lexical evaluation than (lambda () ...)?
Date: Tue, 13 Dec 2011 19:30:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Andy Wingo <address@hidden> writes:
> On Wed 14 Dec 2011 00:00, Noah Lavine <address@hidden> writes:
>> I haven't really been contributing to this thread, so please take my
>> opinion with a grain of salt. But it does appear to me that we should
>> support capturing a lexical environment, as Mark and David describe.
>>
>> So I took a look at ice-9/eval.scm....
>
> The details of the interpreter's implementation are not public, I'm
> afraid.  The interpreter does its job, but not quickly, and any change
> to make it better would involve a change to the environment
> representation.

I agree that the returned "lexical environment object" should opaque.
Probably the only operation that needs this object is "local-eval",
though I'm not sure there's any disadvantage to printing it in
human-readable form for debugging purposes.  It might also be nice to
provide a procedure that converts it into an alist of some sort, but
that's not strictly needed.

I believe this would give us plenty of freedom to change the environment
representation in the future, no?

> Anyway, it's looking in the wrong place.  There is a compiler too.

The most obvious implementation of (capture-lexical-environment) would
inhibit compilation of any top-level form that contains it.  Therefore,
the only thing the compiler would need to do is detect the presence of
(capture-lexical-environment), and in that case, abort compilation of
the entire top-level form.  I guess such a form should be "compiled"
simply as a call to the evaluator with the entire top-level form as its
argument.  This would all happen after macro expansion, of course.

Does this make sense?

      Mark



reply via email to

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