On Dec 6, 2013, at 7:27 AM, Graham Cox <[email protected]> wrote:

> Is the value of <tileRect> here captured when the block is created,or when it 
> is run?

It depends on whether tileRect is an instance variable.
* If it isn’t (i.e. it’s local/static/global), it gets captured when the block 
is created.
* If it _is_ an ivar, then “tileRect” is just syntactic sugar for 
“self->tileRect”, which means that ‘self’ gets captured at create time, and the 
‘->tileRect’ part is evaluated at runtime.

(This is one of many reasons why I believe ivar names should be distinguished, 
e.g. by prefixing them with “_”. Their behavior is different enough from other 
variables that it’s important to be aware of them when reading code.)

—Jens
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to