ppx

OCaml attributes

别说谁变了你拦得住时间么 提交于 2019-12-06 06:48:27
问题 I was looking at the manual and found that there are attributes in OCaml for declaring things as deprecated (see http://caml.inria.fr/pub/docs/manual-ocaml/extn.html), but I can not figure out how to get them to be recognized by the compiler. Here's the program that I wrote: let x = 1 [@@ocaml.deprecated "don't use this"] type t = X | Y [@@ocaml.deprecated "don't use this"] let _ = let y = Y in match y with | X -> print_string (string_of_int x) | Y -> assert false (I also tried [@@deprecated

OCaml attributes

你离开我真会死。 提交于 2019-12-04 12:10:44
I was looking at the manual and found that there are attributes in OCaml for declaring things as deprecated (see http://caml.inria.fr/pub/docs/manual-ocaml/extn.html ), but I can not figure out how to get them to be recognized by the compiler. Here's the program that I wrote: let x = 1 [@@ocaml.deprecated "don't use this"] type t = X | Y [@@ocaml.deprecated "don't use this"] let _ = let y = Y in match y with | X -> print_string (string_of_int x) | Y -> assert false (I also tried [@@deprecated ...] rather than [@@ocaml.deprecated ...] with the same results). I don't get any warnings when I run: