From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 E6807BC40 for ; Tue, 26 Oct 2004 17:05:38 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i9QF5cL0012256 for ; Tue, 26 Oct 2004 17:05:38 +0200 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 RAA05924 for ; Tue, 26 Oct 2004 17:05:35 +0200 (MET DST) Received: from cgpsrv2.cis.mcmaster.ca (cgpsrv2.CIS.McMaster.CA [130.113.64.62]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9QF5YvQ007573; Tue, 26 Oct 2004 17:05:34 +0200 Received: from [65.49.118.93] (account carette@univmail.cis.mcmaster.ca) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro WebUser 4.1.8) with HTTP id 70171963; Tue, 26 Oct 2004 11:05:26 -0400 From: "Jacques Carette" Subject: Re: [Caml-list] Single-case union types as strong typedefs To: Damien Doligez , "'caml users'" X-Mailer: CommuniGate Pro WebUser Interface v.4.1.8 Date: Tue, 26 Oct 2004 11:05:26 -0400 Message-ID: In-Reply-To: <67E54EEE-2758-11D9-BCF8-00039310CAE8@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 417E67C2.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 417E67BE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 typedefs:01 damien:01 damien:01 wrote:01 wrote:01 compiler:01 compiler:01 link-time:01 link-time:01 statically:01 statically:01 run-time:01 compilation:01 compilation: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: Good points, which I will comment on in opposite order: Damien Doligez wrote: > On Oct 25, 2004, at 16:25, Jacques Carette wrote: > > Yes, I am assuming that a fair bit of partial evaluation is a good > > thing for > > the compiler to do. > > Unfortunately, the compiler doesn't have all the information about the > program. A lot of things are not known until link-time. I consider a linker to be an integral part of a compiler 'suite'. I could not care less when a particular code optimization is done. If it *has* to be done by the linker, then so be it. I do not understand why link-time optimizations seem to have been somehow less research-worthy than other parts of the compiler. > > Isn't that correct though? The value x is completely known > > statically, and > > all computation on x can be done statically, so it is not necessary to > > have any traces of x left at run-time. > > Then how do you pass it to a polymorphic function? And then what? What could that polymorphic function do with that value (without using Obj)? In a system which insists on separate compilation, there is indeed a problem, and this ideal cannot be achieved. I should have been clearer about the fact that I knew this. Personally, I do not use separate compilation at "production" time anymore, only at development/debugging time. When it comes time to produce a final executable, I use a colleague's script to make one (large) .ml file containing the complete program. I'd love to have a compiler switch to tell the compiler I am producing an executable in one pass versus creating a reusable library. The intentional differences between those two activities are huge, and apparently still under-recognized (and thus under-used). This is surprising. Side note: Ocaml (and Haskell) are the two languages I actively choose to code in, and get my students to code in, after having coded in a whole bunch of languages (professionally and otherwise). When I need efficiency or non-trivial I/O, I chose Ocaml, if I only need elegance and brevity, I choose Haskell. I still hack in Maple because I can prototype things there faster than in most other languages (for my own work). But I am keeping up with Focal (ex-FOC) and Epigram, as they both seem to be going where I'd like my programming languages to be. Of course, I would rather use fewer languages! So I see it as worth my while to see Ocaml evolve. Jacques