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

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



On 11 Mar 2015, at 23:33, Daniel BÃnzli <daniel.buenzli@xxxxxxxxxxxx> wrote:
> 
> 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):
> 
> https://gist.github.com/dbuenzli/b5f7dd42ecd7f3f0765a
> 
> 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. 

At a quick read through of the APIs, this is extremely compelling.  I 
particularly like the idea of replacing our (extremely vestigial) OS module 
with the platform-independent Bos.  It provides several missing elements that 
we sorely need, such as logging formatters and combinators, in addition to the 
lovely error handling.

I think it could be done without too much code churn just by introducing Bos 
instead of OS in several use points, but it would need a semi-stable Bos 
release cut before that...

-anil
_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

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