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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B734EBC0A for ; Sat, 23 Dec 2006 04:53:36 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBN3rY88012114 for ; Sat, 23 Dec 2006 04:53:35 +0100 Received: from ppp14-213.lns2.syd7.internode.on.net (HELO rosella) ([59.167.14.213]) by ipmail02.adl2.internode.on.net with ESMTP; 23 Dec 2006 14:18:26 +1030 X-IronPort-AV: i="4.12,207,1165152600"; d="scan'208"; a="63906071:sNHT26033651" Subject: Re: strong/weak typing terminology (was Re: [Caml-list] Scripting in ocaml) From: skaller To: Chad Perrin Cc: caml-list@yquem.inria.fr In-Reply-To: <20061222201725.GC23003@apotheon.com> References: <458AA143.3090303@hq.idt.net> <20061221202520.GG9440@apotheon.com> <20061221221650.GL9440@apotheon.com> <3EC73FC3-41A6-4FB1-9549-29286A6568CC@epfl.ch> <1166811403.6555.46.camel@rosella.wigram> <4E1EAAC5-DC08-4A55-9AEB-0D5D3BE1C0EA@epfl.ch> <1166816522.7448.45.camel@rosella.wigram> <458C39FD.7090409@davidb.org> <20061222201725.GC23003@apotheon.com> Content-Type: text/plain Date: Sat, 23 Dec 2006 14:48:23 +1100 Message-Id: <1166845703.7448.172.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 458CA83E.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 type-safe:01 statically:01 abstraction:01 statically:01 ocaml:01 type-safe:01 sourceforge:01 wrote:01 meaningless:01 typing:01 typing:01 caml-list:01 expressive:01 expressive:01 On Fri, 2006-12-22 at 13:17 -0700, Chad Perrin wrote: > This all seems rather simple to me: > > It's type-safe if you cannot get type errors without subverting the type > system. You are missing something. There's no such thing as a 'type error' at run time in a statically typed language. At run time object values are just bit strings, they don't HAVE any types -- and even that is an abstraction (really you just have registers and machine code .. not even really bit strings). Python has a static type system. Did you know? Everything has type 'object'. So in fact Python is quite type safe, and statically so. Big deal. The type system isn't expressive enough for that to mean anything! Similarly, Ocaml is NOT type safe because array bounds can be violated at run time. This is because the type system is not expressive enough to capture the array bound as part of the type. So saying a language is type-safe is meaningless unless you also say how expressive the type system is: either way the program isn't safe, and the choice of typing is often dictated by what can be statically checked, rather than what NEEDS to be checked. So 'type safe' is a fairly vague concept in this sense. It really comes down to "I think Ocaml is a better programming language for my purpose than C++". -- John Skaller Felix, successor to C++: http://felix.sf.net