On Wed, Feb 20, 2013 at 4:37 PM, William Tanksley, Jr <[email protected]> wrote: > Reading back through this discussion was difficult but enlightening. > > Here's how it started: > > On Fri, Feb 15, 2013 at 4:40 AM, Boyko Bantchev <[email protected]> wrote: >> The 'Lexical Closure' essay >> (http://www.jsoftware.com/jwiki/Guides/Lexical%20Closure) >> mentioned in this thread declares lexical closures to be >> 'incompatible with the functional programming model'. >> Such a statement is incorrect. >> If a function returns different values for the same arguments, it >> is not because closures are involved but because that function has >> a changeable state. > > Specifically, this was mentioned in a wiki edit credited to DanBron. > Dan is largely right, except in the part Boyko is quoting; Boyko is > exactly correct that Dan has allowed "stateful" and "closures" to mix > up his words. In context, Dan's contribution is OK, since he's > actually addressing Graham's challenge which implies the same error. > > Raul then claims that Boyko's statement is "not meaningful" because > his usage of the word "function" "conflicts with the usual meaning of > the word". > > Raul is incorrect. Boyko was correct to use the word "function" in the > same sense that Dan (and Graham) used it, and in fact he was > considerate enough to explain why he felt the need to disagree with > them. Furthermore, he did not disagree with them because he used a > different definition of the word "function", but rather because they > (collectively) incorrectly claimed that closures would render a > language not functional.
Note that this was in the context of Paul Graham's challenge -- in other words, using "closure" in the sense that Paul Graham was using it - using stateful lexical scoping to implement generators. > Raul Miller <[email protected]> wrote: >> As I understand it, if closures *are* purely functional they would not >> allow state change. >> I think I would use a different tense (for example, subjunctive tense) >> to express that they have the potential of being purely functional. > > Here Raul makes a statement that means exactly what Boyko said, which > Raul said was "not meaningful". I'm not following your thinking, here. How is treating the "purely functional" case as having an element of unreality the same as the idea that closures (in a stateful context) are purely functional? -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
