> On Jul 5, 2016, at 9:27 AM, Jens Alfke <j...@mooseyard.com> wrote:
> 
>> On Jul 5, 2016, at 4:36 AM, Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> 
>> wrote:
>> 
>> It surprises me that I have to write different synthesis code for 32- or 
>> 64-bit builds
> 
> It’s because they use different Obj-C runtimes. For compatibility reasons, 
> 32-bit Mac apps still use the old runtime, while 64-bit apps (and all iOS 
> apps) get to use the new improved runtime.
> 
> One of the differences between the runtimes is how instance variables are 
> accessed, and I think your particular situation — trying to synthesize a 
> property backed by an _inherited_ ivar — is an edge case.

A synthesized property must use one of the following types of storage:
1. An ivar in that class that @synthesize creates.
2. An ivar in that class that you defined yourself.

@synthesize on 32-bit macOS doesn't support #1. The problem is that 32-bit 
macOS doesn't support non-fragile ivars. Allowing @synthesize to create ivars 
would make it too easy to accidentally change ivar layout and break 
compatibility.

No platform allows @synthesize to bind to a superclass ivar. That would make it 
too easy to accidentally bind to an unrelated superclass ivar when you really 
wanted to create a new ivar.


-- 
Greg Parker     gpar...@apple.com <mailto:gpar...@apple.com>     Runtime 
Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to