[Top][All Lists]

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

Re: leaf environments vs eval environments?

From: Marius Vollmer
Subject: Re: leaf environments vs eval environments?
Date: 23 Jun 2001 02:42:08 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102

Michael Livshin <address@hidden> writes:

> Neil Jerram <address@hidden> writes:
> >     Lars> If this doesn't work, what is the recommended method for
> >     Lars> doing what I'm trying to do?  A static/global this-binding
> >     Lars> isn't an option - it must be local to the evaluation.
> > 
> > ... but I'm afraid I don't know how you should do this.  Hopefully
> > someone else will have the answer later.
> the thing to do is to stop fiddling with experimental and potentially
> expensive features (like environments), and instead to make "this" a
> fluid.


you might take a slightly different approach and treat the script that
is inside your object as a function that is applied now and then.

Like, when the sciprt string is set in your object, create a closure
from it, by tacking "(lambda (this) " on the front and ")" on the back
and evaluate it in the interaction envitronment or whatever
environment you deem to be the right one, saving the returned closure

Then, when the time comes to execute the script, simply apply the
closure object to the "this" smob.  This would be more efficient than
re-parsing and re-evaluating the string from scratch every time.

reply via email to

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