Content deleted Content added
Line 20:
I think that the definition as given here isn't really accurate. As far as I understand the term, the point is just that there is no difference between a function and a data type in the things you can do. This implies that you can assign local variables to functions, and then call those local variables in exactly the same way as you'd call a function. It implies that you can pass functions as arguments to other functions. Creating a function at runtime seems to me to be a completely different thing. In particular, you can achieve similar effects in every language I know of - even if you have to compile the code yourself into memory. I don't think that passing a function pointer around as in c, or wrapping the code in an inner class (java) or a Proc (ruby) qualifies as first-class functions. The point is that they are 'first-class' - that they don't need special treatment. [[User:88.96.214.6|88.96.214.6]] 10:25, 22 March 2007 (UTC)
: Clearly there are different interpretations of this term, so just listing the meaning you or I happen to be most familiar with is not going to produce an adequate article. It's better to make a clearer list of individual language features and discuss them separately. Features would at least include:
:* syntactic support for passing functions (or function pointers) as arguments and yielding them as results, such that the function in question can subsequently be invoked (C has that)
:* function types in the type system (C has that)
:* support for closures (see above) (not in C)
: I don't think an eval function, Lisp macros, C macros, C++ templates, code generation, or Java / .NET reflection are features that belong in this list. As remarked above it would be good to explicitly make this clear was well. [[User:Rp|Rp]] ([[User talk:Rp|talk]]) 08:17, 7 April 2008 (UTC)
== Does Ruby really have first class functions? ==
|