This is the mail archive of the guile@sources.redhat.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: variable binding


Keisuke Nishida <kxn30@po.cwru.edu> writes:

>   % guile -q
>   guile> (define (foo) (+ 1 2))
>   guile> (foo)
>   3
>   guile> (define + -)
>   guile> (foo)
>   3

That's certainly a bug in the new guile sources.  `+'
and `-' are procedures, not syntax.


user/guile> (define (foo) (+ 1 2))
user/guile> (foo)
3
user/guile> (define + -)
user/guile> (foo)
-1
user/guile> 


> How should `define' work with modules, and when should bindings be
> resolved?  

I don't think the above problem has anything to do with the module
system, it might be a problem with the memoizer.  Just look at 
the source. :)


> I guess this is because `define' creates a new binding in a module
> when first called, then it works same as `set!'

Heaven, no -- Even a module system for scheme must respect RnRS. :)
That means that define must shadow an imported binding.


Jost

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