Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Alex Zavatone
On May 20, 2015, at 7:16 PM, Michael David Crawford wrote: You could comment off their declarations in your header files, then have a look at which uses of them in your sources result in fatal compiler errors. Bingo. That will do it. Thanks much to everyone on this. It's certainly

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Alex Zavatone
On May 20, 2015, at 7:17 PM, Jens Alfke wrote: On May 20, 2015, at 4:08 PM, Eric Wing ewmail...@gmail.com wrote: You could use the Objective-C runtime to find out which things are properties. You could, but isn’t it a lot easier to just look at the character before the name and

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Graham Cox
On 22 May 2015, at 2:28 am, Alex Zavatone z...@mac.com wrote: if you use myThing, it's not visually obvious that you're directly accessing the ivar This is where a consistent and deeply ingrained naming convention is useful. The leading underscore has always been Cocoa’s “way” of doing

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Graham Cox
On 22 May 2015, at 3:02 am, Jens Alfke j...@mooseyard.com wrote: Now that I have a path forward and understand why things are what they are, this brings up the wonderful speed issue of how much slower is property access vs ivar access”. Yeah, I think we’ve had some vigorous debates

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread John McCall
On May 21, 2015, at 4:44 PM, Graham Cox graham@bigpond.com wrote: On 22 May 2015, at 3:02 am, Jens Alfke j...@mooseyard.com wrote: Now that I have a path forward and understand why things are what they are, this brings up the wonderful speed issue of how much slower is property access

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Jens Alfke
On May 21, 2015, at 6:43 AM, Alex Zavatone z...@mac.com wrote: Also, you can turn it off autosynthesis? How? That would be a big help for me to straighten out this iOS project where the original developers thought everything needed to be a java bean. As Graham said, go to the build

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Jens Alfke
On May 21, 2015, at 9:28 AM, Alex Zavatone z...@mac.com wrote: @synthesize thing = _thing; Which makes the internal and private ivar to be _thing while the property becomes thing. In my case, this helps to uncover where the original code is accessing the ivar as opposed to the property.

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-21 Thread Alex Zavatone
Ahh. A little follow up. One area we all know about is that you can specialize the name of the property's ivar like so: @synthesize thing = _thing; Which makes the internal and private ivar to be _thing while the property becomes thing. In my case, this helps to uncover where the original

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Ken Thomases
Have to correct a typo: On May 20, 2015, at 3:22 PM, Ken Thomases k...@codeweavers.com wrote: You are accessing a property if you use explicit message sending ([someObject someProperty] or [someObject setSomeProperty:someValue]) or if you use implicit message sending view dot syntax

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Jens Alfke
On May 20, 2015, at 1:04 PM, Alex Zavatone z...@mac.com wrote: Many times in the classes, an ivar is defined in the @interface of the class. Sometimes not. In the old days, before about 2006, the ivars had to be defined in the @interface. Nowadays it’s best to put them in the

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Ken Thomases
On May 20, 2015, at 3:04 PM, Alex Zavatone z...@mac.com wrote: Many times in the classes, an ivar is defined in the @interface of the class. Sometimes not. Then sometimes, the same name of the ivar is used in the class and defined as a property and @synthesized. Sometimes not. Now, I

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Michael David Crawford
there are good reasons to use properties that are backed by ivars, there are good reasons to use properties that aren't backed by anything, and there are good reasons to use ivars that are not properties. In my own code I started with nothing but ivars, but changed some of them to properties

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread David Duncan
On May 20, 2015, at 1:04 PM, Alex Zavatone z...@mac.com wrote: In the code I've inherited, I've got the benefit of spending some time refactoring and have an interesting situation. Many times in the classes, an ivar is defined in the @interface of the class. Sometimes not. Then

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Jens Alfke
On May 20, 2015, at 4:08 PM, Eric Wing ewmail...@gmail.com wrote: You could use the Objective-C runtime to find out which things are properties. You could, but isn’t it a lot easier to just look at the character before the name and check whether it’s a “.”? —Jens

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Eric Wing
On 5/20/15, Jens Alfke j...@mooseyard.com wrote: On May 20, 2015, at 4:57 PM, Eric Wing ewmail...@gmail.com wrote: It depends on how pedantic you want to be. As little as possible, honestly. Did you go back and read the original question? The OP is having trouble with basic property-vs-ivar

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Eric Wing
Which are they, ivars or properties? I don't know. I can't tell. Is there any way to inspect an instance and tell if it is a property or an ivar if both the property and ivar have the same name? Fun times, fun times. You could use the Objective-C runtime to find out which things are

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Michael David Crawford
You could comment off their declarations in your header files, then have a look at which uses of them in your sources result in fatal compiler errors. (Comment off just one at a time.) Michael David Crawford, Consulting Software Engineer mdcrawf...@gmail.com http://www.warplife.com/mdc/

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Graham Cox
On 21 May 2015, at 6:50 am, Michael David Crawford mdcrawf...@gmail.com wrote: In my own code I started with nothing but ivars, but changed some of them to properties while neglecting to remove the original ivar. This leaves me somewhat in the same situation as you. Nothing wrong with

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Jens Alfke
On May 20, 2015, at 4:57 PM, Eric Wing ewmail...@gmail.com wrote: It depends on how pedantic you want to be. As little as possible, honestly. Did you go back and read the original question? The OP is having trouble with basic property-vs-ivar distinctions, and dropping a whole bunch of

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Michael David Crawford
If you have so many ivars, or so many properties that it's a lot of work to figure out which is which, quite likely you're doing something wrong. Now you're already refactoring your code, so you're doing something right there. It is quite common that well-done refactoring reduces the numbers of

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Eric Wing
On 5/20/15, Jens Alfke j...@mooseyard.com wrote: On May 20, 2015, at 4:08 PM, Eric Wing ewmail...@gmail.com wrote: You could use the Objective-C runtime to find out which things are properties. You could, but isn't it a lot easier to just look at the character before the name and check

Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Ken Thomases
On May 20, 2015, at 6:57 PM, Eric Wing ewmail...@gmail.com wrote: On 5/20/15, Jens Alfke j...@mooseyard.com wrote: On May 20, 2015, at 4:08 PM, Eric Wing ewmail...@gmail.com wrote: You could use the Objective-C runtime to find out which things are properties. You could, but isn't it a