On Nov 18, 2010, at 00:43, Andreas Grosam wrote:

> Found this bug report related to this issue and the following explanation:
> <http://www.mail-archive.com/llvmb...@cs.uiuc.edu/msg03631.html>:
> 
>> --- Comment #1 from Fariborz Jahanian <fjahan...@apple.com>  2009-06-22 
>> 21:34:42 ---
>> This is part of the language spec. and cannot be changed. Two properties 
>> cannot use the same 'ivar'
>> for their setter/getter synthesis. This is deemed necessary because it will 
>> be extremely error prone to
>> allow the ivar changed via unrelated property operations.
> 
> 
> Error prone for whom? The compiler writer or the programmer?
> 
> IMHO, if this is error prone for the programmer, the rationale doesn't seem 
> to be reasonable enough to me, especially when the properties are readonly.

Really, there's no such thing as a readonly property, only a property that may 
or may not have a setter as well as a getter, and the compiler cannot determine 
absolutely whether or not there is a setter. (That's a consequence of the 
equivalence of @property-related and old-style property definition syntax, at 
least.) If setters are present at runtime, @synthesized ivar-sharing would 
certainly break KVO, and possibly would break @synthesized property atomicity.

If ivar sharing is not allowed for @synthesize, the penalty to the programmer 
is having to write one set of accessors manually -- a trivial task. If ivar 
sharing were allowed, the penalty would be to open up the code to a number of 
KVO notification and multi-threading issues, especially when more code was 
added later -- a distinctly non-trivial burden. 

Are you sure the rationale is so insufficient?


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to