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

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

Le lundi, 2 fÃvrier 2015 Ã 01:45, Christophe Troestler a Ãcrit :

> Since OCaml supports exceptions, I think there is no doubt that we
> must handle them effectively â not just wipe them under the carpet and
> let them abort the program/unikernel.  

That's a little bit like saying OCaml supports objects therefore we should 
program with objects. The fact is that exceptions are almost always misused in 
OCaml API design, most APIs should only ever raise Invalid_argument and that's 
all; however that's really not what you see in practice (I even remember having 
seen new APIs using that insane Not_found exception...).  

Besides you don't have to abort the unikernel you can also install some kind of 
global trap to handle uncaught exceptions (that's e.g. the way fut works [1]). 
I think it's misguided to use them as an error reporting mechanism we have much 
better ways and I highly disagree these better ways will be ignored if you 
provide good combinators to handle them â maybe sloppy programmers will ignore 
them, but then there's so much you can do. The implicitness of exceptions will 
1) also make sloppy programmers ignore them but 2) make it harder to handle 
errors correctly by non-sloppy programmers.



[1] http://erratique.ch/software/fut/doc/Fut.html#exceptions

MirageOS-devel mailing list



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