This is the mail archive of the
mailing list for the Guile project.
Re: tie variable
- To: Jost Boekemeier <jostobfe at calvados dot zrz dot TU-Berlin dot DE>
- Subject: Re: tie variable
- From: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Date: 04 Apr 2000 00:36:39 -0400
- Cc: guile at sourceware dot cygnus dot com
- References: <email@example.com> <firstname.lastname@example.org> <email@example.com>
Jost Boekemeier <firstname.lastname@example.org.TU-Berlin.DE> writes:
> > (define lisp-environment (make-lisp-environment))
> > (environment-ref lisp-environment 'user-full-name)
> > -> (global-ref 'user-full-name)
> Excuse me but what does "-> (global-ref ...)" mean?
> environment-ref looks up a variable binding for `user-full-name' in
> `lisp-environment' and returns a value. If this value is
> a closure and you invoke the closure, it will look up bindings
> in the environment in which it was defined.
(I rename global-ref to lisp-variable-ref.)
Sorry. I want to call an user-defined procedure lisp-variable-ref
whenever a variable is referred in Scheme programs and a procedure
lisp-variable-set! whenever a variable is set by using set!.
Since Emacs Lisp uses dynamic bindings, the object related to a symbol
may change during execution. For some reasons, I decided to call a set
of procedures to handle this. I used the following notation previously:
(lambda () (lisp-variable-ref 'user-full-name))
(lambda (val) (lisp-variable-set! 'user-full-name val))))
(set! (user-full-name) value)
But I want to do the same thing by the following notation:
(set! user-full-name value)
I'm wondering if I can do that by using the new top-level environment.
> Also I don't understand why you want to have two separate variables
> in the lisp and scheme environment. Don't you translate
> lisp to scheme code?
For some reasons, I'm not doing that.