Closures in C and Objective-C
Michel Fortin
michel.fortin at michelf.com
Thu Aug 28 18:57:57 PDT 2008
It appears someone at Apple is adding closures to C and Objective-C.
The approach to referencing variables is different from the D and C++0x
way: the storage class of the variable tells the compiler what to do
with it when referenced in a closure (copy or reference) and there are
functions to increment/decrement the reference count of the
heap-allocated variables, allowing full closures to be returned.
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-August/002670.html>
I thought it might be interesting to compare this approach with the
(somewhat contested) one in D2. For one thing, it allows much finer
control over what and when variables are heap-allocated for the closure
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list