Hi Everyone,

I've just finished porting Remy Demarest's implementation of the  
blocks runtime to the GNU runtime.  This is a new language feature  
introduced by Apple in Snow Leopard, allowing things like Smalltalk  
blocks in Objective-C.  You can find a full description of the feature  
here:

http://clang.llvm.org/docs/BlockLanguageSpec.txt

The syntax is ugly (and, since I know Steve Naroff has read the paper  
where Brad Cox proposed much less-ugly syntax, Apple doesn't really  
have an excuse for this) but the semantics are almost nice (__block  
should be the default, but unfortunately C++ programmers were involved  
in the design).

To play with this, you need a relatively recent build of clang.   
Compile with -fblocks and link against the ObjectiveC2 framework from  
svn and blocks should Just Work™.

In future, I will extend this object to have the same interface as  
Smalltalk blocks, so we can use closures from Smalltalk or Objective-C  
interchangeably.  Note that, unlike Smalltalk blocks, these have no  
introspection, no reflection, and no self pointer, and so are less  
flexible.

David
_______________________________________________
Etoile-dev mailing list
Etoile-dev@gna.org
https://mail.gna.org/listinfo/etoile-dev

Reply via email to