bug-guile
[Top][All Lists]
Advanced

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

Re: Strange undefined binding bug coupled to module system


From: Marius Vollmer
Subject: Re: Strange undefined binding bug coupled to module system
Date: Wed, 22 Dec 2004 16:35:18 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Mikael Djurfeldt <address@hidden> writes:

> What's needed seems to be to factorize scm_sym2var a little.
>
> Or, we could switch to the environments.c implementation!  :-)

I have changed module-make-local-var! a bit:

  (define (module-make-local-var! m v)
    (or (let ((b (module-obarray-ref (module-obarray m) v)))
          (and (variable? b)
               (begin
                 ;; Mark as modified since this function is called when
                 ;; the standard eval closure defines a binding
                 (module-modified m)
                 b)))

        ;; No local variable yet, so we need to create a new one.  That
        ;; new variable is initialized with the old imported value of V,
        ;; if there is one.
        (let ((imported-var (module-variable m v))
              (local-var (or (and (module-binder m)
                                  ((module-binder m) m v #t))
                             (begin
                               (let ((answer (make-undefined-variable)))
                                 (module-add! m v answer)
                                 answer)))))
          (if (and imported-var (not (variable-bound? local-var)))
              (variable-set! local-var (variable-ref imported-var)))
          local-var)))

That should do it, or?




reply via email to

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