I know the above is an example, but... it is generally preferable to
not use setter accessors in init, it is better to set the ivars
directly:
There was a pretty heated debate once.
Not to repeat all the arguments of both sides, I daresay now with
Objective C 2.0 we can safely conclude that the _current_
recommendation is the very opposite of what you are pointing out: we
_should_ use setters in init (and dealloc and anywhere else).
The reason is extremely simple: we should do that all the time, since
(a) sometimes we just _have to_*, (b) and it's better to keep
consistent in the others cases.
The (a) is indisputable. The (b) of course can be argued, but at least
for me, in this case I consider inconsistence _considerably_ worse
source of potential errors and problems.
*Namely, if you use @synthesize to generate the ivar for a 64-bit
environment, there is no standard way to access the ivar directly.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden