Content deleted Content added
→Availability: Neither Ruby nor Perl offer function pointers -- the latter offers function wrappers (`Proc`). |
|||
Line 7:
== Availability ==
Languages which are strongly associated with functional programming, such as [[Lisp programming language|Lisp]], [[Scheme (programming language)|Scheme]], [[ML programming language|ML]], and [[Haskell (programming language)|Haskell]], all support first-class functions. Other languages which also support them include [[Io programming language|Io]], [[Python (programming language)|Python]], [[ECMAScript]] ([[JavaScript]]), [[Lua programming language|Lua]], [[Nemerle]],
Most modern, natively compiled programming languages (e.g. [[C (programming language)|C]] and [[Pascal programming language|Pascal]]) support function pointers, which can be stored in data structures and passed as arguments to other functions. Nevertheless, they are not considered to support first-class functions since, in general, functions cannot be created dynamically during the execution of a program. The closest analog would be a dynamically compiled function created by a [[just-in-time compiler]], which is compiled as an array of [[machine language]] instructions in memory and then cast to a function pointer. However, this technique is specific to the underlying hardware architecture and is, therefore, neither general nor portable. The [[C++]] programming language supports user-defined operators, including the '()' operator, which allows first-class objects to be treated as functions. Those objects can be manipulated just like any other first-class object in C++, but such manipulations do not include changing the function itself at runtime. Additionally, real Lambdas (see [[Lambda_calculus|Lambda Calculus]]) have no language support in the last C++ standard (although there may be in [[C++0x]]).
|