Practical Implications
Historically, the upwards funarg problem has proven to be the more difficult. For example, the Pascal programming language allows functions to be passed as arguments but not returned as results; thus implementations of Pascal are required to address the downwards funarg problem but not the upwards one. The Oberon programming language (a descendant of Pascal) allows functions both as parameters and return values but the assigned function may not be a nested function. The C programming language historically avoids the main difficulty of the funarg problem by not allowing function definitions to be nested; because the environment of every function is the same, containing just the statically-allocated global variables and functions, a pointer to a function's code describes the function completely. Apple has proposed and implemented a closure syntax for C that solves the upwards funarg problem by dynamically moving closures from the stack to the heap as necessary. The Java programming language deals with it by requiring that context used by nested functions in anonymous inner classes be declared final. C# has lambdas (closures) that encapsulates a function pointer and related variables.
In functional languages, functions are first-class values and can be passed anywhere. Thus, implementations of Scheme or SML must address both the upwards and downwards funarg problems. This is usually accomplished by representing function values as heap-allocated closures, as previously described. The Objective Caml compiler employs a hybrid technique (based on program analysis) to maximize efficiency.
Read more about this topic: Funarg Problem
Famous quotes containing the words practical and/or implications:
“Juggling produces both practical and psychological benefits.... A womans involvement in one role can enhance her functioning in another. Being a wife can make it easier to work outside the home. Being a mother can facilitate the activities and foster the skills of the efficient wife or of the effective worker. And employment outside the home can contribute in substantial, practical ways to how one works within the home, as a spouse and as a parent.”
—Faye J. Crosby (20th century)
“The power to guess the unseen from the seen, to trace the implications of things, to judge the whole piece by the pattern, the condition of feeling life in general so completely that you are well on your way to knowing any particular corner of itthis cluster of gifts may almost be said to constitute experience.”
—Henry James (18431916)