Menu

#124 hygenic renaming incorrect for implicit module import

closed-fixed
nobody
None
5
2005-03-27
2005-02-16
No

The following

(module m (a b)
(module ((a x))
(define x 10)
(define (a) x))
(module ((b x))
(define x 20)
(define (b) x)))
(import m)
(display (a))

displays 10 in Petite Chez Scheme but 20 in SISC 1.9.6.

Looking at the output of sc-expand:

...
(#%begin
(#%set! |@m::x| 10)
(#%set! |@m::a| (#%lambda () |@m::x|))
(#%set! |@m::x| 20)
(#%set! |@m::b| (#%lambda () |@m::x|)))

I suspect that SISC's feature of naming module exports
with the name of the module ("@m::a") to support
independant compilation of modules is being incorrectly
applied in the case of implicit imports. Since the two
definitions of "x" are in separate syntactic scopes,
the identifier should be hygenically given different names.

Thank you,

Andrew

Discussion

  • Scott G. Miller

    Scott G. Miller - 2005-03-23

    Logged In: YES
    user_id=25869

    The difference is that Chez doesn't support independent
    compilation, but we do. This is a bug, but it may not be
    easily fixable. Is this occuring in real code?

     
  • Andrew Wilcox

    Andrew Wilcox - 2005-03-24

    Logged In: YES
    user_id=1220549

    > Is this occuring in real code?

    Yes, this bug causes my proposed reference implementation
    for SRFI-65 (see
    http://srfi.schemers.org/srfi-65/srfi-65.html\) to not work
    in SISC.

    However, I believe that for SISC a working implementation of
    the SRFI can be made by constructing a unique identifier for
    the normally hidden, but exported, "promise" variable.

     
  • Scott G. Miller

    Scott G. Miller - 2005-03-27
    • status: open --> closed-fixed
     
  • Scott G. Miller

    Scott G. Miller - 2005-03-27

    Logged In: YES
    user_id=25869

    Fixed in CVS. Hopefully this fix will be general enough to
    cover all cases. Testing need to be sure.

     

Log in to post a comment.

MongoDB Logo MongoDB