Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think that downward capture of bindings from an enclosing scope counts as "leakage" and I've never seen it lead to the maintainability issues you describe. In Perl and JavaScript, under certain conditions variable scope can leak upward, and that opens up its own can of fresh hell.

Lexical scope also allows the lambda calculus to work, and with it powerful constructs like parameterized functions over values, and fine-grained restriction of variable access through lexical closures. An eager young Scheme programmer can write a module or object system for Scheme in an afternoon.

Tcl allows those things to be written, but they're a bit more involved. And you have to exercise caution, as which bindings are live when a particular Tcl script gets executed is not clear from the program text. (I believe Tcl with upvar actually has dynamic scope semantics which, yet again, can of hell.) But hey, it's a wonderful thing that Tcl admits as much metaprogramming as it does, that puts it well ahead of many popular languages.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: