Using properties (was Re: Outlets / IBOutlet declarations)
Using properties (was Re: Outlets / IBOutlet declarations)
- Subject: Using properties (was Re: Outlets / IBOutlet declarations)
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 19 Nov 2008 20:53:21 -0800
On Nov 19, 2008, at 8:40 PM, Michael Ash wrote:
On Wed, Nov 19, 2008 at 5:41 PM, mmalcolm crawford <email@hidden
> wrote:
On Nov 19, 2008, at 2:29 PM, Michael Ash wrote:
Because there's essentially no good way to dispose of properties
given
the way that they're implemented.
I'm not sure why this is the case?
You send a release message to instance variables for which there is a
corresponding retain or copy property.
This does not qualify as "good" in my book. A fundamental of good
programming is "once and only once". You've now described the
semantics of these properties in two different places in your code
and, worse, one of those places is implicit rather than explicit.
I'm not sure what you mean here?
There is only one place where the semantics are described: In the
property declaration.
Whether you release or not in dealloc is a corollary of that
declaration.
But you have the same problem without properties.
Except that it's worse; you could change the implementation of an
accessor
method (to assign rather than retain, for example), and you'd have no
cross-check to make sure you then did the right thing in dealloc.
With properties, you have a clear set of statements that publicly
declare
what are the memory management semantics, and you can cross-check
them with
your dealloc method.
This is true but I don't really see the point. I never said properties
were worse than manual accessors, just that this omission really hurts
their utility.
In which case we may be mostly in violet (sic) agreement.
I obviously see significant benefits to using properties, and agree
that their utility *might* be enhanced if they could also handle
dealloc. I got the impression that others here were suggesting that
they provide little or no benefit at all...
mmalc
_______________________________________________
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