Talk:Closures/Value capture

From Rosetta Code
Revision as of 11:46, 20 July 2011 by rosettacode>Dgamey (→‎Sample output: function description)

Sample output

Sample output is always useful in the task description.
While the task says display, the requirement is there but what is left up to the implementer.
The Python example does not show it's output.

--Dgamey 11:33, 20 July 2011 (UTC)

Function description a bit vague

A bit more specification/clarity would be helpful. I think I understand, but I shouldn't have to read one of the code examples to be sure.
The description "such that the function at index i (i from 0 to 9), when run, should return the number i." sounds like the function just returns its argument. It says nothing about how the return value behaves. It looks like we are meant to use a closure to create what is effectively a constant.
Why 10 functions? Surely two or three would be sufficient to demonstrate how this works? The python example seems to put these in a list.

--Dgamey 11:46, 20 July 2011 (UTC)