[racket] hash-ref
At Sun, 18 Jul 2010 22:55:44 +0200, "Jos Koot" wrote:
> Now consider:
>
> (let ((var ...))
> ...
> (hash-ref hash key (lambda () var))
>
> Do I understand well that this thunk is not cq cannot be compiled to a
> constant?
Correct.
> When compiling the thunk, the location of var relative to the top of the
> stack is known, is it not?
Yes, its location is known for the purpose of saving the value in a
newly created closure. The compiler doesn't see the body of `hash-ref',
though, so it cannot avoid code to allocate the closure.