>> When you unarchive one of those strings, code expecting an instance of 
>> UnencodableFoo will instead have an NSString, the use of which will likely 
>> throw exceptions, eg: when code calls -[UnencodableFoo fooThing]
> 
> No, it's not likely if UnencodableFoo is *my* code, because I program 
> defensively when dealing with input data such as an archive :)

To defend against your solution you'd have to test every decoded object in the 
graph with something like:

        if( ! [decodedObject isKindOfClass:[XXExpectedClass class]] ) ...

Otherwise you don't know if you just decoded one of those strings you silently 
substituted. 

Hitting an exception at the time of archiving is much better- it identifies the 
problem immediately. If you're trying to archive something that can't be 
archived, you need to know and change your code (eg: write the missing encoding 
method, choose a different data representation, etc).

~Martin

_______________________________________________

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