Re: Threaded drawing
Re: Threaded drawing
- Subject: Re: Threaded drawing
- From: Jens Alfke <email@hidden>
- Date: Fri, 06 Dec 2013 11:37:56 -0800
On Dec 6, 2013, at 7:27 AM, Graham Cox <email@hidden> 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@hidden)
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:
This email sent to email@hidden