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]

Scheme48's `(define a a)'


In the scheme48 module system it is possible to shadow a top level binding
from another module with the same top level binding in the current module.

For example:

    module "hugo"                module "werner" uses "hugo"

    (define a 1)                (define a a)   shadow binding from hugo
                                (set! a 2)    
    a -> 1                      a -> 2

 
What do you think, should guile support this behaviour?  


Scheme48 has no `undefine'. That means when you shadow a foreign symbol
you can't access this symbol any more. 
In Guile when you `undefine' a symbol, it is simply marked as undefined but
the binding is still there. You can't remove the vcell (symbol . value)
completely since this binding may have been memoized (expressions are 
pointing to value directly).

In other words, we can either support the above behaviour and drop 
`undefine' or we keep `undefine' and don't implement this feature.


guile> (module "hugo")
hugo> (export-symbols '(a))
hugo> (define a 1)
werner> (module "werner")
werner> (vector-set! (current-module) 1 (list (module* "hugo")))
werner> a -> 1
werner> (define a a)
werner> (set! a 2)
werner> (to-module "hugo")
hugo> a -> 1
hugo> (to-module "werner")
werner> (undefine a)
werner> a -> unbound error ... SHOULD BE: a -> 1
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Jost