From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA10969; Wed, 12 Sep 2001 09:22:43 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA10902 for ; Wed, 12 Sep 2001 09:22:43 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8C7MgT00025 for ; Wed, 12 Sep 2001 09:22:42 +0200 (MET DST) Received: from pc803.lri.fr (IDENT:root@pc803 [129.175.8.114]) by ext.lri.fr (8.11.6/jtpda-5.3.2) with ESMTP id f8C7Mfb23344 ; Wed, 12 Sep 2001 09:22:41 +0200 (MET DST) Received: by pc803.lri.fr (8.9.3/feuille) id JAA30679 ; Wed, 12 Sep 2001 09:22:42 +0200 X-Authentication-Warning: localhost.localdomain: filliatr set sender to filliatr@pc803 using -f From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15263.3393.960387.171645@pc803> Date: Wed, 12 Sep 2001 09:22:41 +0200 (MEST) To: "SooHyoung Oh" Cc: "caml-list" Subject: Re: [Caml-list] Why warning? In-Reply-To: <00b901c13b53$4e3bc9b0$1e01a8c0@hama> References: <00b901c13b53$4e3bc9b0$1e01a8c0@hama> X-Mailer: VM 6.49 under Emacs 20.4.1 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk SooHyoung Oh writes: > > Why is this warning occurred? > Where can I get infomation about this? (ex: 'nnn' page on manual, articles > or books) > > # 1; 2;; > Warning: this expression should have type unit. > - : int = 2 In the sequence "expr1; expr2", the result of expr1 is discarded. Thus, whenever the result of expr1 is not "()" (i.e. expr1 is not of type "unit") the Caml compiler gives you a warning (you may have typed ";" instead of "," for instance, or any similar typo) This warning may be disabled, as explained in the manual: http://caml.inria.fr/ocaml/htmlman/manual021.html But you should rather write your code in a different way, having expr1 of type unit, or explicitly ignoring its result. There are (at least) two possibilities: let _ = expr1 in expr2 or better ignore (expr1); expr2 "ignore" is part of the Caml code library; see http://caml.inria.fr/ocaml/htmlman/manual031.html#@manual94 Best regards, -- Jean-Christophe Filliatre (http://www.lri.fr/~filliatr) ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr