[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Error handling in Mirage - request for comments!

Le dimanche, 22 mars 2015 Ã 14:43, Thomas Leonard a Ãcrit :
> Yes, but the question is whether this information is worth the
> overhead.  

Again programmatically there's no overhead if you are using the right set of 
combinators and type definitions. You can say there is a performance overhead 
but at a certain point you have to choose whether you want correct, safe and 
reliable systems or favour performance. I'm strongly in favour of the former 
and have both whenever possible.  

> - We must assume that some implementation of a Mirage module type may
> produce an error (they're all about I/O, after all), so annotating
> every function to say this doesn't provide any extra information.

This misses the point. Having every functions annotated provides you 
information *in the type system* which gives you a mechanism to *enforce* good 
and correct error handling in the program. Using exceptions doesn't allow you 
to enforce error handling and is otherwise very dangerous because 1) You 
basically don't know when they happen except through documentation, so they are 
easy to miss and not handle them (if documentation exists at all...) 2) They 
disrupt your whole callstack, possibly leaking resources and putting your 
program in a bad state by breaking invariants that should hold in our system  
3) The source of the exception may be hard to track 4) They are hard to reason 
about and handle correctly.


MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.