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=none autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 48FD5BC69 for ; Fri, 16 Nov 2007 19:10:43 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJBrPUeCz6WljGdsb2JhbACPDQEBAQgEBgkGGoEP X-IronPort-AV: E=Sophos;i="4.21,427,1188770400"; d="scan'208";a="4338716" Received: from deliverator5.gatech.edu ([130.207.165.165]) by mail2-smtp-roc.national.inria.fr with ESMTP; 16 Nov 2007 19:10:42 +0100 Received: from deliverator5.gatech.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 51D521D19CB; Fri, 16 Nov 2007 13:10:41 -0500 (EST) (envelope-from fernando@gatech.edu) Received: from mailprx4.gatech.edu (mailprx4.prism.gatech.edu [130.207.171.18]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "smtp.mail.gatech.edu", Issuer "RSA Data Security, Inc." (verified OK)) by deliverator5.gatech.edu (Postfix) with ESMTP id DBA901D199B; Fri, 16 Nov 2007 13:10:33 -0500 (EST) (envelope-from fernando@gatech.edu) Received: from localhost (gato.physics.und.nodak.edu [134.129.186.227]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) (sasl: method=PLAIN, username=gtg783d@mailprx4.gatech.edu, sender=n/a) by mailprx4.gatech.edu (Postfix) with ESMTP id B929C21DC; Fri, 16 Nov 2007 13:10:29 -0500 (EST) (envelope-from fernando@gatech.edu) Date: Fri, 16 Nov 2007 12:10:24 -0600 From: Fernando Alegre To: Edgar Friendly Cc: Martin Jambon , caml-list , Alain Frisch Subject: Re: [Caml-list] Compiler feature - useful or not? Message-ID: <20071116181024.GA15777@gato.physics.und.nodak.edu> References: <473BE750.9060301@frisch.fr> <20071115132649.GB15754@yquem.inria.fr> <891bd3390711151630x238b8eddod5b7462d0fa1c735@mail.gmail.com> <473D61A3.9090708@frisch.fr> <473DD301.90307@gmail.com> <473DD956.7090608@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <473DD956.7090608@gmail.com> User-Agent: Mutt/1.5.9i X-Spam: no; 0.00; compiler:01 casts:01 casts:01 runtime:01 run-time:01 ocaml:01 type-safe:01 typecheck:01 segfault:01 compile-time:01 edgar:98 constants:01 wrote:01 exception:01 caml-list:01 On Fri, Nov 16, 2007 at 11:54:30AM -0600, Edgar Friendly wrote: > > > Explicit casts, my friend. Explicit casts to convert from int to Yes. I think explicit casts should be extended to some of these cases. > permission and back. And automatically generated runtime checks to > ensure that you don't try to convert ( 37 :> permission ). 1 remains an No, no. Run-time checks are evil :-) I mean, OCaml is supposed to be a static type-safe system, so that programs that typecheck are guaranteed to run (maybe forever...) and never segfault. While exceptions are needed for I/O, no core expression should raise an exception. I think explicit casts of compile-time constants is safe (sound?), and explicit casts of a general (int :> finite type) are unsafe. I don't know whether there is a middle ground that can be both safe and useful. I guess some of the researchers on this list must know the answer (or know there is no answer, or whatever...) Thanks, Fernando