[plt-scheme] Okay, this is ugly
On Feb 18, 2006, at 7:50 AM, Shriram Krishnamurthi wrote:
> It's hard to even begin to explain why this code is awful,
> and almost certainly buggy, but aren't you just trying to say:
>
> (define (env-get-binding s env)
> (unless (null? env)
> (hash-table-get (car env) s
> (lambda ()
> (env-get-binding s (cdr env))))))
>
> ?
>
> Shriram
That was actually my first thought, but I didn't think I could call
env-get-binding in the failure thunk of hash-table-get.
I'm unhappy with this code for other reasons, too. Once concern
(though not one with which I was going to trouble the list) is that
I'm afraid I might be introducing dynamic scope. The point of the
code is to facilitate evaluation of expressions like
(let ((x 2))
(let ((y 3))
(+ x y))
but I should statically know I only have two lets here, so I'm
actually rethinking my evaluation strategy.
===
Gregory Woodhouse
gregory.woodhouse at sbcglobal.net
"Doubt may be uncomfortable,
but certainty is absurd." --Voltaire