gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSIMap


From: Jens Ayton
Subject: Re: GSIMap
Date: Thu, 16 Jun 2011 12:46:20 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]