[Top][All Lists]

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

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

From: David Kastrup
Subject: Re: Anything better for delayed lexical evaluation than (lambda () ...)?
Date: Wed, 14 Dec 2011 23:24:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

David Kastrup <address@hidden> writes:

> (define (my-eval form env)
>   (call-with-current-continuation
>    (lambda (x)
>      (env (list x form)))))
> (define-macro (my-env)
>   (call-with-current-continuation
>    identity))
> (format #t "~a" (my-eval '(+ x 3) (let ((x 4)) (my-env))))
> Mark H Weaver <address@hidden> writes:
>> In fact it makes me wonder whether `the-environment' and `local-eval'
>> could actually be implemented this way.  I see some complications that
>> might make this strategy impractical or fragile, most notably that we
>> must be assured that the (call/cc) does not happen until
>> (the-environment) would have been _evaluated_, whereas the
>> expander/memoizer/evaluator will want to see what code is there _before_
>> evaluation.  I'll have to think about this.  There might be an easy and
>> robust way to do this, or maybe not.
> Feel free to experiment with the above.  I have my doubt that it leads
> to sane behavior.  In particular, it will refinish macro expansion (so
> you don't want significant material behind it) and reevaluate the
> _whole_ eval it is in up to the point of calling my-env (so you don't
> want significant material before it).
> So it is more a joke than anything of practical value.  But is _is_ good
> for a few dropjaws.

Actually, if the evaluator does macro expansion on the fly instead of en
bloc, it may even be a practical joke.

David Kastrup

reply via email to

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