On Fri, Jul 3, 2009 at 1:42 AM, Jerry Krinock<je...@ieee.org> wrote: > > On 2009 Jul 02, at 21:11, Michael Ash wrote: > >> Is there a reason you can't just implement a new method in a category >> and not replace the existing one? It will be just as safe in your >> code, just as easy to use, > > I'd considered doing that and yes it could be done. But then it would have > a different method name that I'd have to remember to use instead of > -unarchiveObjectWithData:. > > Replacing a Cocoa method seems like it should only be done if the original > method shipped by Apple is buggy. I believe that's the case here. The only > behavior I'm losing is a potential crash.
Well, that's wrong. The behavior you're losing is that of throwing an exception on error. It is entirely possible that Apple's code relies on this method throwing an exception on error. As your own code demonstrates, you can catch the exception in question without crashing. You're not fixing a bug, unless you consider throwing an exception to always be a bug AND you consider any code which relies on catching an exception to likewise be a bug. You're changing existing non-buggy behavior. That's a bad thing to do unless you have a VERY good reason, and IMHO "a different method name that I'd have to remember to use" is a pretty crappy reason for this. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com