In computer science, the funarg problem refers to the difficulty in implementing first-class functions (functions as first-class objects) in implementations with stack-based memory allocation.
The difficulty only arises if the body of a nested function refers directly (i.e., not via argument passing) to identifiers defined in the environment in which the function is defined, but not in the environment of the function call. To summarize the discussion below, two standard resolutions are to either forbid such references or to create closures.
There are two subtly different versions of the funarg problem. The upwards funarg problem arises from returning (or otherwise transmitting "upwards") a function from a function call. The downwards funarg problem arises from passing a function as a parameter to another function call.
Read more about Funarg Problem: Upwards Funarg Problem, Downwards Funarg Problem, Practical Implications
Famous quotes containing the word problem:
“It is very comforting to believe that leaders who do terrible things are, in fact, mad. That way, all we have to do is make sure we dont put psychotics in high places and weve got the problem solved.”
—Tom Wolfe (b. 1931)