Talk:Closure (computer programming): Difference between revisions

Content deleted Content added
m Fgnievinski moved page Talk:Closure (computer science) to Talk:Closure (computer programming) over redirect: to rectify hatnote
Smerdis (talk | contribs)
Added comment to the "First Example (Python)" section
Line 777:
: Also, the new example fails to demonstrate that the state captured in a closure can be mutable. I'll restore the old example. —''[[User:Ruud Koot|Ruud]]'' 11:19, 11 February 2012 (UTC)
::I agree that the lambda code is too mysterious to be helpful here, and the example you just restored is better. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 01:59, 12 February 2012 (UTC)
 
: I find the [https://en.wikipedia.org/w/index.php?title=Closure_(computer_programming)&oldid=595411369#Example | current example] misleading since the closure returned by <code>counter</code> is an impure function, printing different values for calls on the same argument. The fact that the state captured in a closure can be mutable is important, and should be mentioned somewhere in the article, but presenting this as a canonical example is likely to mislead readers into thinking that closures are by nature impure (misleading since purely functional languages like Haskell of course allow closures as well). —[[User:Smerdis|Smerdis]] 27 February 2014