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 UAA09044; Thu, 21 Oct 2004 20:55:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA09720 for ; Thu, 21 Oct 2004 20:55:19 +0200 (MET DST) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i9LItIXp003499 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Oct 2004 20:55:19 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay03.plus.net with esmtp (Exim) id 1CKi5k-000IO7-5x for caml-list@inria.fr; Thu, 21 Oct 2004 18:55:16 +0000 From: Jon Harrop To: "caml-list" Subject: [Caml-list] Polymorphism and the "for" loop Date: Thu, 21 Oct 2004 19:50:43 +0100 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200410211950.43396.jon@jdh30.plus.com> X-Miltered: at concorde with ID 41780616.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; inferred:01 val:01 polymorphic:01 objects:02 unit:03 unit:03 let:04 cheers:06 polymorphism:06 loop:06 loop:06 type:07 type:07 fun:08 rather:09 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Considering the following code objects to the expression in the "for" loop not having the type "unit": # for i=0 to 3 do 1 done;; Warning: this expression should have type unit. - : unit = () why is "g" in the following code inferred to have the polymorphic type (unit -> 'a) rather than (unit -> unit)? # let f g = for i=0 to 3 do g () done;; val f : (unit -> 'a) -> unit = Cheers, Jon. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners