space leak in redefinitions

Taylor R Campbell <[email protected]> Sun, 6 Mar 2011 21:35:14 +0000
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
The definition of CLOBBER-BINDING! in bcomp/binding.scm doesn't remove
the binding's location if a variable is being redefined as syntax.
This can leak space, and leads to a weird state where (v ...) refers
to the syntax and v outside an operator position refers to the old
variable.

It's not clear to me why CLOBBER-BINDING! has a conditional at all,
(if place (vector-set! binding 1 place)), instead of unconditionally
replacing the place.  I wonder what the intent was?

Example:

> (define x 0)
; no values returned
> (define-syntax x (syntax-rules () ((x) 1)))
#{Unspecific}
> (x)
1
> x

Warning: invalid variable reference
         x
         #{Package 221 user}
         (&warning)
0
>