Funarg Problem

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 part of the educator’s responsibility to see equally to two things: First, that the problem grows out of the conditions of the experience being had in the present, and that it is within the range of the capacity of students; and, secondly, that it is such that it arouses in the learner an active quest for information and for production of new ideas. The new facts and new ideas thus obtained become the ground for further experiences in which new problems are presented.
    John Dewey (1859–1952)