From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id DAB42BC2F for ; Sat, 27 Nov 2004 04:47:50 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iAR3lo3a005144 for ; Sat, 27 Nov 2004 04:47:50 +0100 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 EAA00820 for ; Sat, 27 Nov 2004 04:47:48 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iAR3lkwJ005139 for ; Sat, 27 Nov 2004 04:47:47 +0100 Received: from [192.168.1.200] (ppp217-171.lns1.syd3.internode.on.net [203.122.217.171]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id iAR3lh4Y094344; Sat, 27 Nov 2004 14:17:44 +1030 (CST) Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement? From: skaller Reply-To: skaller@users.sourceforge.net To: Hendrik Tews Cc: caml-list In-Reply-To: References: <1101427906.9291.107.camel@pelican.wigram> <20041126.094412.30442729.garrigue@math.nagoya-u.ac.jp> <1101438486.9291.138.camel@pelican.wigram> <20041126.142525.93385094.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain Message-Id: <1101527262.9291.572.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 27 Nov 2004 14:47:42 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41A7F8E6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41A7F8E2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlopt:01 failwith:01 sourceforge:01 hendrik:01 tews:01 wrote:01 notation:01 ocaml:01 ocaml:01 glebe:01 ...:98 061:98 writes:01 nsw:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Sat, 2004-11-27 at 09:24, Hendrik Tews wrote: > Jacques Garrigue writes: > > Note that void in C is definitely not zero. You cannot have variables > > C++ standard, 3.9.1.9: The void type has an empty set of values. ... > > So I would say void is zero. On the other side you have functions > returning void. Therefore I would conclude that the type theory > of C++ is unsound. I'm not sure I quite understand (not that I disagree with the conclusion..) void in C++ is initial. However, this function: int f(); is NOT a function void -> int because in C/C++ you have a list of arguments: g(a,b,c) If you construe the list as a product, so that the function int g(int,float,long) has type int * float * long -> int then you must construe the type of f as unit -> int since the product of an empty list is unit, and NOT void. The notation for application: f () even looks like f is being applied to an Ocaml empty tuple :) In particular in C++ you will note that this does NOT type correctly: void f(); f( f() ); because the type of f() is void, and the type of the argument is actually unit. This means C/C++ has stronger typing in this respect than Ocaml :) -- 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