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 EAA27083; Fri, 22 Oct 2004 04:22:43 +0200 (MET DST) 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 EAA26791 for ; Fri, 22 Oct 2004 04:22:41 +0200 (MET DST) Received: from mail.math.berkeley.edu (mail.math.Berkeley.EDU [169.229.58.57]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i9M2MdnQ026080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 22 Oct 2004 04:22:41 +0200 Received: from blue1.Math.Berkeley.EDU (IDENT:2040@blue1.Math.Berkeley.EDU [169.229.58.58]) by mail.math.berkeley.edu (8.12.11/8.12.11) with ESMTP id i9M2McuG098943; Thu, 21 Oct 2004 19:22:38 -0700 (PDT) (envelope-from solovay@math.berkeley.edu) Received: from localhost (solovay@localhost) by blue1.Math.Berkeley.EDU (8.12.10+Sun/8.12.10/Submit) with ESMTP id i9M2MbJM029523; Thu, 21 Oct 2004 19:22:37 -0700 (PDT) X-Authentication-Warning: blue1.Math.Berkeley.EDU: solovay owned process doing -bs Date: Thu, 21 Oct 2004 19:22:37 -0700 (PDT) From: "Robert M. Solovay" X-X-Sender: solovay@blue1 To: skaller cc: David Brown , Jon Harrop , caml-list Subject: Re: [Caml-list] Polymorphism and the "for" loop In-Reply-To: <1098407993.7584.6.camel@pelican.wigram> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.45 X-Miltered: at concorde with ID 41786EEF.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 2004:99 2004:99 argued:01 inferred:01 inference:01 argued:01 level':01 9660:01 glebe:01 bug:01 faq:01 faq:01 beginner's:01 beginners:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk How does one define a function f of type int -> void? I looked in the OCaml manual and couldn't find any reference to "void". {It is, of course, a familiar concept in C.} --Bob Solovay On 22 Oct 2004, skaller wrote: > 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 > ------------------- 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