On Aug 21, 2010, at 1:21 PM, Shriram Krishnamurthi <[email protected]>
wrote:
Your reduction of this guideline to what you claim Hansen preached (I
haven't seen that essay) is unfair. The D guideline does not say
"don't have nested scope". It says to not allow lexical re-binding,
which is a much, much finer point.
...
I mean, it's all visible in scope, so renaming is easy; why not just
give it a different name? It might even be clearer to the reader!
It might not. In the it-only example, the reader knows that the outer
bindings cannot be used by the inner ones, so the reader can read
inward without having to be warey of the outer bindings. In the itsy-
bitsy example, the reader cannot immediately discern whether the outer
bindings are used by the inner ones. On rare occasions I have
intentionally shadowed variables for this reason (e.g., coordinate
transformations.)
RAC
(let ([it 5])
(+ ...
(let ([it 10])
(... ...
...
it))))
Uh, which `it'?
(let ([itsy 5])
(+ ...
(let ([bitsy 10])
(... ...
...
bitsy))))
(Aha, not `itsy'!)
Shriram
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users