This is the mail archive of the guile@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]

Variables and scheme


Eric M. Ludlam writes:

 >   So, is this easy, hard, or blasphemous?

you would need to funnel all evals through a lookup function that
prefers the "current" drawing area.  if you're already explicitly
calling eval, it is simple (just add another layer).  if not, you need
to add infrastructure and that may be hard, depending on other things i
don't know about. :->

below are some code snippets from thud-0.11 (i've since gone more static
and no longer use `eval2') that might be helpful.  `vob' and `fob' are
variable and function obarrays, respectively.  note that on failure to
find a reference in the "local" obarrays, `*top-level-lookup-closure*'
and then `builtin-variable' are consulted.  lastly, `ef' is a so-called
"execution form", typically a "set!" for thud.

thi


--------------------------------------------
	(eval2 ef thud-eval-lookup)

(define d-ref hashq-ref)

(define (thud-eval-lookup symbol define?)
  ;(say "thud-eval-lookup:" symbol)
  (or (d-ref vob symbol)
      (d-ref fob symbol)
      (*top-level-lookup-closure* symbol #f)
      (builtin-variable symbol)
      (die "failed!")))