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.

I suppose Method Replacement has disadvantages too. I have to remember to include this method replacement file in any new project I start, or else I'll get the old crashy behavior, since I'll be out of the habit of using try/catch.

and it won't run the potential risk of screwing up code that you don't control.

Interesting -- but the only "screwing up" I'm doing is allowing it to execute beyond a point where it otherwise would have crashed. I suppose that if someone is using this crashing "feature" of - unarchiveObjectWithData: as some kind of self-destruct security mechanism, I could be introducing a security hole :))

Anyhow, I get your point.

Thanks, Michael.

_______________________________________________

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

Reply via email to