On 11/19/11 1:56 AM, Niko Matsakis wrote:
> 
> On Nov 18, 2011, at 4:51 PM, Niko Matsakis wrote:
> 
>>   1. You know exactly what the failure means and an exact, transparent
>>      recovery mode. For this we recommend simply modeling the recovery
>>      mode you want for expected-but-rare circumstances as arguments
>>      passed *into* the callee, and handled at the site of
>>      circumstance. Think of how O_CREAT and O_TRUNC work in ::open.
>>      We have these wonderful tag things for passing in such options,
>>      they can be highly structured if necessary.
> 
> This is a good point, however.  Moving the recovery into the code itself is 
> elegant, when it applies; I'm not sure how much this generalizes.  Have to 
> think about it. 

I can't remember the title of the original exceptions paper, but if I
recall correctly, exceptions were initially designed specifically to
avoid such behaviors, as this quite often leads to messy and unreliable
code.

Oh, and a simple example where it does not work: you do not want to deal
with scenario "user has suddenly removed the USB key" smack in the
middle of your code for, say, serializing your data structure to a
compressed output stream for said key. You want to do this at higher level.

Cheers,
 David

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to