guile-devel
[Top][All Lists]
Advanced

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

Re: scm_module_define ?


From: Neil Jerram
Subject: Re: scm_module_define ?
Date: Wed, 06 Jul 2005 00:13:44 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1

Han-Wen Nienhuys wrote:
> Why is module-define! not implemented using scm_module_define ?

Good question.  AFAICS, the difference between these reduces to the
difference (if any) between

[scm_define_module]
(variable-set! (module-make-local-var! module name) value)

and

[module-define!]
(or (module-local-variable ...)
    (let ((variable (make-variable value)))
      (module-add! module name variable)))

And the only difference between these appears to be in the case where
the module has a lazy binder: the scm_define_module code will call the
lazy binder with 3rd arg #t, whereas the module-define! code will call
it with 3rd arg #f.  I don't know if this difference matters, but I'd
guess not, as surely the point of a lazy binder is actually to do a
definition when asked for either a lookup or a definition.

What a mess this code is, though.  It feels as though if someone had the
patience, they could reduce it by 90% just by applying careful
mechanical transformations and removing duplication.

        Neil




reply via email to

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