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)
“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
〔☛ Emacs Lisp Symbol (tutorial)〕
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.