Re: Looking at self = [super init].
Re: Looking at self = [super init].
- Subject: Re: Looking at self = [super init].
- From: Charles Srstka <email@hidden>
- Date: Tue, 02 Jun 2015 14:13:54 -0500
On Jun 1, 2015, at 11:43 PM, Britt Durbrow <email@hidden> wrote:
>
> Although I have the luxury of requiring modern runtime capable systems, some people do still have to target the old runtime…
ARC requires the modern runtime, which has pretty much caused the old one to drop off the map for most people, I think.
> Also, FWIW the modern runtime only handles same-named instance variables that are privately declared; same-named variables declared in an @interface section will conflict even on the modern runtime.
Variables declared in an @interface section trigger a compiler warning:
warning: declaration of instance variables in the interface is deprecated [-Wobjc-interface-ivars]
> Oh, and there’s a nifty warning that’s thrown as soon as you try to declare a local variable of the same name as an instance variable.
That doesn’t help if I’m looking at some code that someone else wrote, or code that I wrote 5 years ago, noticing a variable name being used somewhere, and having to hunt around for the declaration to figure out whether it’s a local variable, an instance variable, or something stupid like a global or something.
>> On Jun 1, 2015, at 3:14 PM, Charles Srstka <email@hidden <mailto:email@hidden>> wrote:
>
>>
>> Non-underscored ivars vs. local variables, however, are not obvious at all, especially if the method is large.
>
> In modern versions of Xcode at least, if I don’t know exactly what I’m looking at, the answer is just a command-click away… :-)
That can be handy, when it works. Sometimes it doesn’t (particularly when you’re using Swift, in which command-click usually just brings up an endless circular progress indicator).
> Also, the syntax highlighting does render (at least on my setup) in different colors for local variables and instance variables.
That can be handy, if you’re not colorblind. If you are, the coloring isn’t much help.
Charles
_______________________________________________
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