caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocaml 4.03 and warning 52 : argument of this constructor should not be matched against a constant pattern
@ 2016-04-27  9:22 William
  2016-04-27  9:28 ` David Allsopp
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: William @ 2016-04-27  9:22 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-04-28  7:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27  9:22 [Caml-list] ocaml 4.03 and warning 52 : argument of this constructor should not be matched against a constant pattern William
2016-04-27  9:28 ` David Allsopp
2016-04-27  9:36 ` Daniel Bünzli
2016-04-27  9:43   ` Jacques-Henri Jourdan
2016-04-27  9:51     ` Roberto Di Cosmo
2016-04-27 10:00     ` Daniel Bünzli
2016-04-27 10:04       ` Jacques-Henri Jourdan
2016-04-28  7:25         ` Goswin von Brederlow
2016-04-27 11:01 ` Gabriel Scherer
2016-04-27 17:17   ` Adrien Nader
2016-04-27 18:20     ` Gabriel Scherer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).