Re: NSXMLParser bug?
Re: NSXMLParser bug?
- Subject: Re: NSXMLParser bug?
- From: "Michael Ash" <email@hidden>
- Date: Fri, 12 Sep 2008 11:41:04 -0400
On Fri, Sep 12, 2008 at 6:55 AM, Graham Cox <email@hidden> wrote:
> By the way, the operative word with my comment regarding NSView was
> "effective". I can see that init can just pass a zero rect, but does that
> make a useful view? No, not really - but perhaps I miss the point a bit
> there. The idea is to return an object that is viable, and won't crash,
> right? Not one that is actually useful (without further set up).
Many objects aren't useful without further setup no matter how they're
initialized.
I personally use NSView with a plain -init sometimes. It's useful when
using autosizing controls. For example, I can alloc/init an
NSTextField, configure it, set its value, then call -sizeToFit to get
it to match its contents. Using -initWithFrame: would just be
redundant.
Really, a plain -init should give you one of three things:
1) An object that is ready for normal use. For example, NSFileManager.
2) An object which can be further configured for normal use. For
example, NSView.
3) An object which, while not necessarily useful, is still functional
as a blank/empty object. For example, NSArray.
Sometimes -init can't help but give you an object that's fairly
useless, but it shouldn't be crashing, in any case.
Mike
_______________________________________________
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