Talk:First-class function: Difference between revisions

Content deleted Content added
Line 140:
I am not exactly an expert, but I think having first class functions is neither stronger nor weaker than having anonymous functions:
 
* This is probably a stupid and very atypical example, but if you consider Java's reflection subsystem a core part of the language (this is not usually done), then Java arguably has first-class functions, modulo the kludgey syntax. But I don't think it has anonymous functions, since every function is actually a method in a class and must have a name as such. (There may however be a way to have a free name chosen dynamically.) A more straightforward example would be a programming language with a lambda operator that takes an explicit, non-optional parameter that serves as the name of the function. Of course you could work around this with a factory for unique names. This shows that the line is rather blurry, while the previous example shows that there may be real issues. [PS: I see now that Macrakis came up with this idea before me.]
* Apparently recent versions of Visual Basic support anonymous functions. If this had been added to an earlier version I would be quite sure that these wouldn't be first class. I am not familiar with the .NET version of VB, though, so it's quite possible that they are first class. It's easy to create an artificial example of such a language. Just take a language with first class anonymous functions and add the restriction that functions may be assigned to parameter variables of functions (when calling the function), but not to ordinary variables.