This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: tie variable



In order to support Emacs Lisp's dynamic bindings in a multi-threaded
environment, I think we're going to need to introduce the concept of
variables for which arbitrary code gets run to retrieve and set their
values.

In particular, I think we need a magic type of object which, when
stored in a variable, causes references and assignments to that
variable to call functions specified by that object.  For obvious
reasons, objects of this type can only be manipulated directly in C.

That way, we can implement Emacs Lisp bindings as magic objects which
refer to per-thread data.  To bind a variable the Emacs Lisp way, we
store one of these magic values in the variable.  When the binding
goes out of scope, we restore the variable's old value.

We could use this to implement buffer-local variables, too.

To reduce the overhead, we could make the `unbound' value, which the
interpreter already checks for, one of these objects, whose reference
and assignment functions signal an `unbound variable' error.

Does the interpreter check for unbound values in local variables?  If
not, then this would still introduce some overhead.  But I believe
this is inevitable if we really want to support Emacs Lisp.  The
alternatives involve forbidding multi-threaded Emacs Lisp code, which
is really gross.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]