> On Apr 30, 2017, at 1:05 PM, Quincey Morris > <[email protected]> wrote: > > On Apr 30, 2017, at 09:46 , Jonathan Schleifer <[email protected] > <mailto:[email protected]>> wrote: >> >> the others do not list nonatomic - making them atomic, which is the default > > You and Charles are both right, in a way. > > 1. What you describe is the original semantics of property atomicity. For > some reason, the decision was taken to make properties default to “atomic”, > but no attempt was made to convert any pre-existing getter/setter > implementations, and no attempt was made to verify that any new custom > accessors provided atomicity. The whole thing was broken right from the start. > > 2. Although nothing syntactic has ever changed, common usage has changed over > the years, to (informally) regard the default (omission of attribute) and > explicit “atomic” as different things, in terms of API contract. The usage > has come to be that only properties explicitly marked “atomic” can be > reasonably assumed to be making an API contract, and that properties without > the attribute make no API contract (even if they happen to be atomic as an > implementation detail). > > Note that atomic/nonatomic, like strong/weak/etc, have an ambiguous role in > property declarations. Their actual effect is to guide the code that’s > generated for a *synthesized* property, and nothing else — they affect > nothing the compiler does at a call site. At the same time, they’re > (informally and unreliably) taken as an API contract for users of the > property. > > What ought to have happened, once Apple realized that this ambiguity existed, > was to move synthesis-related attributes to the @synthesize statement, and to > leave attributes on @property statements as “advice” to callers. Instead, > Apple (inadvisedly, IMO) went in the opposite direction, making @synthesize > statements optional, and locking the @synthesize-related attributes to the > @property statement. Hilarity ensued, of which this thread is the most recent > manifestation.
Thanks, that’s far more eloquent than my post, and absolutely correct. Charles
_______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com This email sent to [email protected]
