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

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

Just to counter the claim that if each function returns an error code, 
programmers will simply ignore them I would like to point to this program that 
I wrote with rresult and bos (http://erratique.ch/software/bos the OS 
interaction library that was hiding in assemblage):


This program folds over a file hierarchy to find modifications that may have 
occurred between two runs of the program. It will correctly report any kind of 
error that may happen (e.g. inexistant cwd, timestamp database file read/write, 
permission errors, dangling symlinks, etc.) and yet the final programmer hadn't 
anything to do except insert error logging statements at the right place. 

While its error messages could certainly be further improved this already 
brings a very usable program for the final user (no exceptions thrown in the 
face, no silencing of errors) *and* remains non-painful to write for the 
programmer. Everybody wins. 

It relies on OS interaction functions returning result types and an error-wise 
carefully designed file hierarchy folding combinator with appropriate defaults 
[1]. Using Sys (i.e. exceptions) to write the same program with the same level 
of attention to error reporting would have been much more painful and hence 
tempting the lazy programmer (who isn't ?) to eschew the idea of writing a 
usable program.

Let's make MirageOS an *exception*ally usable system from the ground up. 



[1]  http://erratique.ch/software/bos/doc/Bos.OS.Path.html#VALfold

MirageOS-devel mailing list



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