Re: warning: local declaration hides instance variable
Re: warning: local declaration hides instance variable
- Subject: Re: warning: local declaration hides instance variable
- From: Laurence Harris <email@hidden>
- Date: Mon, 3 Sep 2007 17:09:17 -0400
On Sep 3, 2007, at 3:30 PM, Wincent Colaiuta wrote:
El 3/9/2007, a las 20:52, Laurence Harris escribió:
An even better solution would be to rename your instance variables
with a standard naming convention that clearly identifies them as
instance variables. Since they're also referred to as member
variables, a lot of people prefix their names with an "m":
Depends on what you mean by "a lot"; if you mean "multiple people"
then you're right. But "some" would probably be a less misleading
choice because this pattern is most definitely only in minority use
in the Objective-C world (where they are called instance variables,
not member variables, in any case).
Is there a practical reason for people in the Obj-C world to not use
this? If they prefer a differ convention, then that's fine. But to
just say they don't normally use one is hardly a good reason to shun
a potentially beneficial practice.
Seems of dubious value to embed this information in your variable
names when the compiler is (obviously) capable of warning about
possible ambiguities, and the predominant use of accessors means
that direct instance variable manipulation is a fairly rare thing
anyway (think Key-Value Coding, and Objective-C 2.0 properties).
The main value is not to prevent errors of the kind that started this
thread. The main value to me is in making code clear and readable. I
find it much easier to follow what a method/member function is doing
and how and when it's affecting instance/member variables when using
a naming convention that clearly identifies them. Besides, it seems a
lot smarter of me to write code that's correct the first time than to
write code that isn't just because the compiler can catch my mistakes.
Larry _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden