Talk:First-class functions: Difference between revisions

→‎Closures?: new section
(→‎Even C could?: Another informative link.)
(→‎Closures?: new section)
Line 43:
 
::Thanks Dmitry. That is a valid point. I guess if a language has problems with the example but can reason, (making a better case than C), why it has first class functions, then they should make their case too. Maybe they could cover the four points by other means. --[[User:Paddy3118|Paddy3118]] 18:25, 24 February 2009 (UTC)
 
== Closures? ==
 
Maybe this task is actually requiring [[wp:Closure (computer science)|closures]]? The concepts of first-class functions and closures are very inter-related and often confused. The ability to make a "compose" function requires closures, because the returned function needs to be able to remember ("close" around) the input functions when it is created so that it can use them to compute the correct result. When you talk about "creating" functions at run time, what you care about is the ability for it to close around run-time variables in scope at that time. Because if you couldn't do that, you would have what is morally equivalent to C function pointers, because they would be statically known at compile-time, and you could just "lift" them out of the functions that created them. --[[User:Spoon!|Spoon!]] 20:25, 24 February 2009 (UTC)
Anonymous user