[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #516: letrec fails when used in re-assigning top-leve
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #516: letrec fails when used in re-assigning top-level bindings |
Date: |
Fri, 25 Feb 2011 21:35:02 -0000 |
#516: letrec fails when used in re-assigning top-level bindings
---------------------------------------+------------------------------------
Reporter: syn | Owner: felix
Type: defect | Status: new
Priority: major | Milestone: 4.7.0
Component: compiler | Version: 4.6.x
Keywords: compiler letrec top-level |
---------------------------------------+------------------------------------
The following program works as expected when interpreted, i.e. it prints
"hey". However, when compiled it prints {{{#<unbound value>}}} or, when
compiled as a shared object, it signals {{{unbound variable: foo#bar}}}.
The comments in the program point out two ways of making it work when
compiled. It seems that the optimizer removes the original binding of
{{{bar}}} when {{{letrec}}} is used for its redefinition. Putting some
top-level code between definition and re-definition prevents that as well
as replacing {{{letrec}}} with {{{let*}}}. Note that the module form can
be left out to reproduce the problem, too.
{{{
(module foo
(bar)
(import chicken scheme)
(define bar 'hey)
;; uncommenting the next line makes it work when compiled
;; (print 'some-top-level-expression)
(set! bar
;; changing the letrec to a let* also makes it work when compiled
(letrec ((baz bar)
(qux (lambda () baz)))
qux))
(print (bar))
)
}}}
--
Ticket URL: <http://bugs.call-cc.org/ticket/516>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-janitors] #516: letrec fails when used in re-assigning top-level bindings,
Chicken Trac <=