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]

Re: let not binding correctly?


Rob Engle <grenoble@spimageworks.com> writes:

>   (intern-symbol symtable 'there)
> [...]
>                 (write-line bucket)
>                 (for-each
>                     (lambda (elem) 
>                         (let ((one (car elem)) (two (cdr elem)))
>                             (write-line (cons one two))
>                         )
> [...]
>   ((there . #<undefined>))
>   /tmp/y:17:40: While evaluating arguments to cons in expression (cons
> one two):
>   /tmp/y:17:40: Unbound variable: two
>   ABORT: (misc-error)
> [...]
> Anybody have any ideas why?

Yes.  It is due to a design bug in the symbol-table function
interface.  There should be no way in which the value #<undefined>
can leak out to the Scheme level.

*This* is the bug, not that the interpreter starts to behave strangely
when a variable is bound to it.

A temporary workaround is to avoid storing (cdr elem) in any variable,
local or global.

Best regards,
/mdj