Content deleted Content added
No edit summary |
|||
Line 133:
:Please ''don't'' merge AF here, except maybe a mention that just as say, a number can be passed between/assigned to several variables in a language; the concept of an Anonymous Function is a function that can be assigned to multiple variables or stored in collection types, which aids in making functions as first class as other types in the language. --[[User:Paddy3118|Paddy]] ([[User talk:Paddy3118|talk]]) 21:57, 20 August 2009 (UTC)
:: So what is an anonymous function according to you? Does C have them? You can do all of what you wrote above in C using function pointers, but you cannot have unnamed functions in C. [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 01:12, 21 August 2009 (UTC)
:::I come from a Lisp background, so anonymous functions are near and dear to my heart. However, the core semantic issue here is not whether the functions are anonymous, but whether they are first-class objects which can be assigned to variables, passed as arguments, etc. Consider a (non-existent) variant of Lisp, where closures were created by something like (lambda funcname (arg1 arg2) ...) instead of simply (lambda (arg1 arg2) ...). That would be an utterly trivial variant which might allow the printer (for example) to print a closure as #<function funcname> instead of #<function 234234> but would otherwise have no impact on the language.
:::As for the C case, if you're willing to consider function pointers as functions, then the fact that the only way you can create a function ''constant'' within the language (that is, not unsafely converting an untyped pointer to a function pointer) is by binding it to an identifier is again a trivial syntactic detail. [[Anonymous function]] should be merged into [[First-class function]]. --[[User:Macrakis|macrakis]] ([[User talk:Macrakis|talk]]) 02:16, 21 August 2009 (UTC)
|