From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 6DDADBC69 for ; Thu, 4 Oct 2007 21:56:28 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGriBEfAXQImh2dsb2JhbACOOAEBCQon X-IronPort-AV: E=Sophos;i="4.21,232,1188770400"; d="scan'208";a="17305900" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 04 Oct 2007 21:56:28 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l94JuRvw012053 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 4 Oct 2007 21:56:27 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACHiBEfLENaMnmdsb2JhbACOOAEBAgcEBic X-IronPort-AV: E=Sophos;i="4.21,232,1188770400"; d="scan'208";a="2150835" Received: from ipmail01.adl2.internode.on.net ([203.16.214.140]) by mail1-smtp-roc.national.inria.fr with ESMTP; 04 Oct 2007 21:56:26 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACLfBEd5LHvc/2dsb2JhbAAM X-IronPort-AV: E=Sophos;i="4.21,232,1188743400"; d="scan'208";a="204333503" Received: from ppp121-44-123-220.lns10.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.123.220]) by ipmail01.adl2.internode.on.net with ESMTP; 05 Oct 2007 05:26:21 +0930 Subject: Re: [Caml-list] Unsoundness is essential From: skaller To: rossberg@ps.uni-sb.de Cc: caml-list@inria.fr In-Reply-To: <59808.84.159.34.129.1191520580.squirrel@www.ps.uni-sb.de> References: <20071003083529.40DA2A99F@Adric.metnet.fnmoc.navy.mil> <4703FDEF.7030900@univ-savoie.fr> <1191451810.7218.86.camel@rosella.wigram> <59808.84.159.34.129.1191520580.squirrel@www.ps.uni-sb.de> Content-Type: text/plain Date: Fri, 05 Oct 2007 05:56:15 +1000 Message-Id: <1191527775.7078.67.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 4705456B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 rossberg:01 integers:01 bug:01 bug:01 denying:98 sourceforge:01 wrote:01 wrote:01 dynamically:01 compile:01 compile:01 integer:01 exception:01 exception:01 On Thu, 2007-10-04 at 19:56 +0200, rossberg@ps.uni-sb.de wrote: > skaller wrote: > > > > All advanced programming languages have unsound type systems > > of necessity. Some falsely claim soundness by denying the > > expression of certain type information (eg array bounds > > or the type of integers excluding zero). > > No. Soundness is the absence of /untrapped/ errors. Fair .. > Exceptions are /trapped/ errors. I chose not to accept that definition. I use instead "trapped at compile time", meaning "in advance of running the program". Otherwise you could say dynamically typed languages were strongly typed and sound. I'm not saying that it is a bad thing to emit code to generate diagnostics at run time, if you can't prove safety at compile time .. I AM saying that doing that means the type system is unsound, because by type system I mean "static type checking". The point is that static checks are hopefully rigorous: what ever properties they ensure they ensure them for certain, once and for all time. Whereas dynamic checks prove only, in some cases, that there is a bug and thus you have to actually test the program with good coverage, and even then you learn little UNLESS there is a bug :) Also note, specified exceptions are not suitable traps: this is a conformance issue and not really related, but it is worth noting that if a catchable exception is specified, the condition that caused it to be raised isn't necessarily an error: try: x = "Bad" +42 except: print "Python WILL print this" This code is perfectly well defined and contains no errors, not even a type error. Adding a string to an integer raises TypeError in Python, and this is mandatory, so this behaviour is well defined and can be used as a programming technique (and it is!), there is no 'trapped' error here. C/C++ does this right: if a program is 'ill-formed' then a diagnostic must be issued. Throwing an exception silently is NOT allowed. [C/C++ doesn't mandate diagnostics always because some are too hard to detect] -- John Skaller Felix, successor to C++: http://felix.sf.net