Marc Feeley wrote:
In Scheme "The result of the `set!' expression is unspecified." In the interpreter `set!' returns the #!void object, for which the REPL does not produce any output. The compiler introduced a cell ("box" type) to store the value of t, and transformed (let ((t 0))... into (let ((t (box 0))... and (set! t q) into (set-box! t q). And the set-box! procedure returns the box that was set, so that's what `set!' returns in compiled code.
I could change the implementation of set-box! so that it returns #!void, and then the result of the compiler and interpreter would be the same. This will probably have a (very) small impact on performance.
Thanks for reply!
Do not bother with this, Marc.
I never use results from functions with unspecified result in my code.
Just suddenly found difference in behavior of compiled and interpreted code, and that is why I asked the question.
Vasil