From: Nicolas C. <war...@fr...> - 2003-06-23 02:50:42
|
> val catch_all : ('a -> 'b) -> 'a -> 'b option I REALLY don't like the idea of "catching+ignoring all exceptions". That would encourage programmers to write incorrect code. > val catch: exn list -> ('a -> 'b) -> 'a -> 'b option > val catch_not: exn list -> ('a -> 'b) -> 'a -> 'b option > val tr_exn: (exn * exn) list -> ('a -> 'b) -> 'a -> 'b I'm not really sure about theses. Actually it's true we're sometimes doing something like try List.find my_pred my_list with Not_found -> raise My_exception But I'm not sure that writing : tr_exn [(Not_found,My_exception)] (List.find my_pred) my_list is more readable. And more than that, most of the time, you want to raise an exception with some parameter. Then theses functions are getting a litlle less usable ( + performances of list allocation and search ). Nicolas Cannasse |