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:

    The problem is simply this: no one can feel like CEO of his or her life in the presence of the people who toilet trained her and spanked him when he was naughty. We may have become Masters of the Universe, accustomed to giving life and taking it away, casually ordering people into battle or out of their jobs . . . and yet we may still dirty our diapers at the sound of our mommy’s whimper or our daddy’s growl.
    Frank Pittman (20th century)