On Jun 10, 2011, at 15:23, David Chisnall wrote:
> 
> In that case, someone should tell Apple: as I said in the original post, this 
> contract is not honoured by all of their classes.  Both Apple, and 
> LanguageKit's closure implementations return a different object in response 
> to -retain if the block is allocated on the stack.

Not true. Under OS X, retaining a block on the stack does nothing; -copy must 
be used. This is both the documented and observed behaviour.

There are two reasons for this: 1) -retain is a no-op under garbage collection, 
but blocks still need to be copied to the heap; 2) it would violate the 
contract of -retain as per the NSObject protocol documentation.


-- 
Jens Ayton


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to