{"id":1789,"date":"2017-05-18T03:20:38","date_gmt":"2017-05-17T18:20:38","guid":{"rendered":"https:\/\/blog.ymyzk.com\/?p=1789"},"modified":"2017-05-18T16:40:56","modified_gmt":"2017-05-18T07:40:56","slug":"ocaml-unused-variable","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2017\/05\/ocaml-unused-variable\/","title":{"rendered":"OCaml \u306e\u672a\u4f7f\u7528\u5909\u6570\u306e\u8b66\u544a\u306b\u3064\u3044\u3066"},"content":{"rendered":"
OCaml \u306b\u304a\u3044\u3066\uff0c\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u306f\u672a\u4f7f\u7528\u5909\u6570\u306e\u8b66\u544a\u304c\u51fa\u307e\u3059\u304c\uff0c<\/p>\n
$ ocaml\r\n OCaml version 4.04.0\r\n\r\n# let x = 1 in 1;;\r\nWarning 26: unused variable x.\r\n- : int = 1<\/code><\/pre>\n\u6b21\u306e\u3088\u3046\u306a\u5834\u5408\u306f\u672a\u4f7f\u7528\u5909\u6570\u306e\u8b66\u544a\u304c\u51fa\u307e\u305b\u3093\uff0e<\/p>\n
$ ocaml\r\n OCaml version 4.04.0\r\n\r\n# let f x = 1;;\r\nval f : 'a -> int = <fun><\/code><\/pre>\n\u3053\u306e\u9055\u3044\u304c\u6c17\u306b\u306a\u3063\u305f\u306e\u3067\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n
<\/p>\n
OCaml \u306e\u8b66\u544a\u306b\u3064\u3044\u3066\u6700\u3082\u8a73\u3057\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u306e\u306f ocamlc(1) \u306e man page<\/a> \u306e\u3088\u3046\u3067\u3059\uff0eOCaml \u3067\u306f\u8b66\u544a\u306e\u7a2e\u985e\u3054\u3068\u306b\u756a\u53f7\u304c\u3064\u3044\u3066\u304a\u308a, OCaml 4.04.0 \u306b\u306f\u4e00\u90e8\u6b20\u756a\u306f\u3042\u308a\u307e\u3059\u304c 1 \u304b\u3089 61 \u307e\u3067\u3042\u308a\u307e\u3059\uff0e\u672a\u4f7f\u7528\u5909\u6570\u306b\u3064\u3044\u3066\u306e\u8b66\u544a\u306f\uff0c\u4ee5\u4e0b\u306e2\u7a2e\u985e\u3067\u3059\uff0e<\/p>\n26 Suspicious unused variable: unused variable that is bound
\nwith let or as, and doesn’t start with an underscore (_) charac-
\nter.<\/p>\n
27 Innocuous unused variable: unused variable that is not
\nbound with let nor as, and doesn’t start with an underscore (_)
\ncharacter.<\/p>\n