[cfe-dev] blocks and lambdas

David Chisnall theraven at sucs.org
Tue Feb 8 15:56:11 PST 2011


On 8 Feb 2011, at 21:39, James Gregurich wrote:

> given the lambda is the cross-platform standard, I think being able to pass the lambda to the Cocoa callback-using APIs and to libdispatch is the useful situation


I'm not sure what this means.  Blocks are also a cross-platform solution.  We shipped a working blocks runtime as part of √Čtoil√© six months before Apple shipped theirs, and it's now been incorporated into GNUstep.  I've used blocks on OS X, FreeBSD, OpenBSD, Solaris, and Linux.  Apple (more recently) released their blocks runtime as part of LLVM's compiler-rt project, so you can use blocks without an Objective-C runtime, if you choose.  

Blocks are a cross-platform solution, they're just not well supported by other compilers yet[1], but they're quite useable on a variety of platforms.

David

[1] Actually, they're not well supported by clang yet either - we allocate too many structures for __block variables.

-- Sent from my PDP-11





More information about the cfe-dev mailing list