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 DAA24867; Fri, 22 Oct 2004 03:20:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 DAA24801 for ; Fri, 22 Oct 2004 03:20:03 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9M1K1fV023389 for ; Fri, 22 Oct 2004 03:20:02 +0200 Received: from [192.168.1.200] (ppp217-99.lns1.syd3.internode.on.net [203.122.217.99]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i9M1JrOU066374; Fri, 22 Oct 2004 10:49:55 +0930 (CST) Subject: Re: [Caml-list] Polymorphism and the "for" loop From: skaller Reply-To: skaller@users.sourceforge.net To: David Brown Cc: Jon Harrop , caml-list In-Reply-To: <20041021191156.GA17933@old.davidb.org> References: <200410211950.43396.jon@jdh30.plus.com> <20041021191156.GA17933@old.davidb.org> Content-Type: text/plain Message-Id: <1098407993.7584.6.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 22 Oct 2004 11:19:53 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41786041.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 2004:99 argued:01 inferred:01 inference:01 argued:01 level':01 9660:01 glebe:01 nsw:01 snail:02 checkout:02 silly:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 2004-10-22 at 05:11, David Brown wrote: > On Thu, Oct 21, 2004 at 07:50:43PM +0100, Jon Harrop wrote: > Because its only a warning, not an error. g is allowed to return any type. > It could be argued that the loop expression must be of type unit, then this > could also be inferred by type inference. It can also be argued chosing unit for non-returning function is the wrong choice and that correct choice is void. In particular given f: unit -> unit you can write f ( f () ) which is silly. Given f: unit -> void that expression won't type check. The result is to force 'commands' with side effects and no return values be 'top level' (or at least arguments of for, ';', etc). This seems to work well in Felix. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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