• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disabling auto-synthesis of property accessors.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling auto-synthesis of property accessors.


  • Subject: Re: Disabling auto-synthesis of property accessors.
  • From: Alex Zavatone <email@hidden>
  • Date: Fri, 22 May 2015 07:05:40 -0400

On May 22, 2015, at 3:43 AM, Uli Kusterer wrote:

> On 21 May 2015, at 19:55, Quincey Morris <email@hidden> wrote:
>> On May 21, 2015, at 10:40 , Fritz Anderson <email@hidden> wrote:
>>>
>>> I must have misinterpreted the question. I had understood Alex wanted a build option to turn off the auto-synthesis of properties, so the compiler could complain at every conflation of ivars with @propertys.
>>
>> You didn’t misinterpret the question, but there’s no such build setting, so you have to solve the problem indirectly.
>>
>> — You turn on the @synthesize warning.
>>
>> — The warning message tells you when you’ve omitted a @synthesize.
>>
>> — You add the “new-style” @synthesize:
>>
>> 	@synthesize myProperty = _myProperty;
>>
>> — Then all of your old naked ‘myProperty’ ivar references produce compile errors. QED.
>>
>> Changing an old-style ‘@synthesize myProperty;’ to the new style leads to a similar result, but there’s no initial warning message to lead you there by the hand.
>
> That seems pointless, as auto-synthesis already names the backing ivar it creates _myProperty. Looking at the original thread "Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?” that spawned this, just deleting all the ivar declarations and @synthesize directives might be a better idea, then direct ivar accesses don’t find anything named myProperty and will error out directly. Or synthesize all properties with a name nobody is using yet for the backing ivar, if you have some that use _foo, or mFoo and others that just use foo.

Yeah, but I just tested it this yesterday and it doesn't appear to do that.

It creates an underlying myProperty ivar for a myProperty property, not an underlying _myProperty ivar.

I'll send the source when in get in the office in an hour, so you can test for yourself if you want to.

Cheers,
Alex Zavatone





_______________________________________________

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


  • Follow-Ups:
    • Re: Disabling auto-synthesis of property accessors.
      • From: Alex Zavatone <email@hidden>
References: 
 >Disabling auto-synthesis of property accessors. (From: Alex Zavatone <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Kyle Sluder <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Fritz Anderson <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Quincey Morris <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Disabling auto-synthesis of property accessors.
  • Next by Date: Invalid amor - what does this mean?
  • Previous by thread: Re: Disabling auto-synthesis of property accessors.
  • Next by thread: Re: Disabling auto-synthesis of property accessors.
  • Index(es):
    • Date
    • Thread