We now have a section of the reference manual (which has been updated to 4.03) on Warnings, and this particular warning is documented there: http://caml.inria.fr/pub/docs/manual-ocaml/comp.html#s:comp-warnings Feedback (for example as Mantis tickets) on which warnings are confusing and would deserve additional documentation -- or even patches to provide this documentation -- are warmly welcome. On Wed, Apr 27, 2016 at 5:22 AM, William wrote: > Hello, > > with ocaml 4.03, I came with many warnings such as this one : > > let lst = [] in > try > let fst = List.hd lst in > Printf.printf "fst:%s\n" fst > with > | Failure "hd" -> Printf.printf "empty list\n";; > > Characters 123-127: > | Failure "hd" -> Printf.printf "empty list\n";; > ^^^^ > Warning 52: the argument of this constructor should not be matched against > a > constant pattern; the actual value of the argument could change > in the future. > > > > It occurs typically for Failure "hd", Failure "tl", Failure > "float_of_string", Failure "int_of_string", Failure "lexing: empty token", > Invalid_argument "Filename.chop_extension", ... > > How are we supposed to handle this nicely with the standard library ? Is > there a better approach to catch those exceptions ? > > > Best regards, > > William > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >