This link has been bookmarked by 16 people . It was first bookmarked on 15 Sep 2006, by Navneet Kumar.
-
01 Nov 10
-
27 Nov 09
-
15 Sep 06
-
06 Jul 05
David CorkingThe paragraph clipped below explains that Java C++ and C# have linguistic support for closures. Closures would be more tedious in C.
-
Some object-oriented languages enable the programmer to use objects to simulate some features of closures. For example: * Java allows the programmer to define "anonymous classes" inside a method; an anonymous class may refer to names in lexically enclosing classes, or final names in the lexically enclosing method. * In C++ and D, programmers may define classes that overload the () (function application) operator. Instances of such classes are called function objects, or occasionally functors (although the latter term is confusing, because it has a very different meaning in other programming languages). Such function objects behave somewhat like functions in a functional programming language, but they are different from closures in that variables from their environment are not captured. To approximate an actual closure, one can imagine placing all global variables in a single struct, a copy of which can be passed to a function object. * Support for closures is introduced in version 2.0 of C#. In C#, they are called "anonymous methods".
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.