[Top][All Lists]

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

Re: guile for lisp set

From: Marius Vollmer
Subject: Re: guile for lisp set
Date: 09 Dec 2000 15:09:29 +0100
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

Neil Jerram <address@hidden> writes:

> >>>>> "Marius" == Marius Vollmer <address@hidden> writes:
>     Marius> I think it is best to ignore `eval2' if you can; `eval'
>     Marius> should be enough.  You are in the midst of the slowly
>     Marius> changing module system of Guile.
> Hi Marius,
> Does the same apply to `local-eval'?

Hmm, for my taste, `local-eval' is a strange beast.  I don't know if I
like it to be in the language at all.  It is in any case a _very_
advanced feature of Guile that goes way beyond the Scheme standard.

It is of course OK to document it, but I wouldn't put it among the
basic features of Scheme.

> I would like to use the following code as part of an explanation of
> closure:
> (define tt
>   (let ((s 5))
>     (lambda ()
>       (write (local-eval (read) (the-environment)))
>       (newline))))

This is a good explanation of `local-eval', but I don't think you
should use local-eval to explain the much more basic concept of
closures and lexical scope.  It might be an advanced example for the
very curious at the end of the section on closures (sort of with a
triple dangerous bend sign, if you know the TeXbook), but the essence
of lexical scope should be explained without referring to it.

> Will Guile always have (AFAYK) something like the-environment and
> local-eval to permit referencing and using a local environment?

I don't know.  One important property of lexical scope is that the
data structures used to implement the local environment are completely
at the discretion of the compiler.  It can use a different, optimized
implementation for every chunk of code that has access to that
environment.  And because the scope is lexical, the compiler can
readily identify that chunk of code and doesn't need to tell anyone
how it represents its environments.

`the-environment' and `local-eval' would have to know about the
implementation of environments.  I'd say that this restricts a
compiler significantly.

Furthermore, I don't see the need (other than for implementing the
debugger) for local-eval and actually think it is dangerous.  I almost
put it in the same category as Intercals(?) `comefrom' operator
(which, incidentally, is also actually useful for implementing

So, I myself will avoid using local-eval as long as I can and not
promise that it will always be around.  Others might disagree.

reply via email to

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