programing language: closure should be ban'd

slightly updated. Python: Function with State (closure-like)

btw, hacker-type of programers will probably object, saying that the techniques on that page isn't “closure”. However, if you consider closure as purpose, then it amounts to a function with state. Python can do real closure, which is a function with a “closed off” variable environment. Will have to write a tutorial on that another day. (if you want to know, a web search should easily find you tutorials on that)

see also Python Scope Complexity, Shallow Copy, Deep Copy, Circular List, and the Garbage Underneath Computer Languages

“closure” in programing is something i truely despise. Because it creates a complexity level that's voodoo. All it achieves is function with state. First of all, function with state should be avoided. But if you really want, OOP is a systematic way of function with state, use OOP then. Or, in some languages, use the property of a function, such as in lisp or in JavaScript. 〔☛ Emacs Lisp Symbol (tutorial)〕 〔☛ JavaScript: Closure, and Function with State〕 If you don't want OOP, then, just use global vars with a special scheme of naming them, such as starting with 2 underscore “__” and end with a random id. 〔☛ What's Windows CLSID? Second Life UUID?〕 In fact, many languages uses this scheme to do things. Python has special variables that has underscore in its naming, ⁖ __name__, Mathematica has internal variables name$random string as used by Module[] function to generate local variables. http://reference.wolfram.com/mathematica/ref/Module.html

here's real closure in JavaScript JavaScript: Closure, and Function with State

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs