Opened 11 years ago

Closed 11 years ago

#19 closed defect (wontfix)

define-syntax on imported syntax redefines that syntax in the original module

Reported by: Alex Shinn Owned by: felix winkelmann
Priority: minor Milestone:
Component: compiler Version: 4.0.1
Keywords: Cc:
Estimated difficulty:

Description

CHICKEN
(c)2008-2009 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.0.2 - SVN rev. 14239
macosx-unix-gnu-x86 [ manyargs dload ptables applyhook ]
compiled 2009-04-16 on pchelka (Darwin)

#;1> (module x () (import scheme) (define-syntax import (syntax-rules ())))
; loading /usr/local/lib/chicken/4/scheme.import.so ...

Warning: redefinition of imported syntax binding: import
#;2> (module y () (import scheme) 'ok)

Error: during expansion of (import ...) - no rule matches form: (import scheme)

Call history:

<syntax> (module y () (import scheme) (quote ok))
<syntax> (##core#module y () (import scheme) (quote ok))
<syntax> (import scheme)
<eval> (##sys#cdr input10)
<eval> (##sys#syntax-error-hook "no rule matches form" input10<--

#;2>

Change History (2)

comment:1 Changed 11 years ago by felix winkelmann

Priority: majorminor
Status: newassigned

Funky.

Has a nice correspondence to redefining imported variables...

This is a bug, of course, but an interesting one.

comment:2 Changed 11 years ago by felix winkelmann

Resolution: wontfix
Status: assignedclosed

As the module system does merely rename identifiers (and does not instantiate environments), this behaviour is actually consistent: redefinition of a global value binding changes that value globally. Redefinition of a syntax binding changes the meaning of the syntax in the compiler-run or interpreter session. One can still consider this a bug (and I'm not overly happy with this, since users will probably expect something else), but the current behaviour is, technically, the proper thing to do.

Note: See TracTickets for help on using tickets.