From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA08346 for caml-redistribution@pauillac.inria.fr; Mon, 10 Apr 2000 01:31:23 +0200 (MET DST) Resent-Message-Id: <200004092331.BAA08346@pauillac.inria.fr> 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 SAA09831 for ; Thu, 6 Apr 2000 18:51:33 +0200 (MET DST) Received: from csla.csl.sri.com (csla.csl.sri.com [192.12.33.2]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id SAA11471 for ; Thu, 6 Apr 2000 18:51:24 +0200 (MET DST) Received: from cylinder.csl.sri.com (IDENT:filliatr@cylinder.csl.sri.com [130.107.15.112]) by csla.csl.sri.com (8.9.1/8.9.1) with ESMTP id JAA04548; Thu, 6 Apr 2000 09:51:07 -0700 (PDT) Received: (from filliatr@localhost) by cylinder.csl.sri.com (8.9.3/8.8.7) id JAA16347; Thu, 6 Apr 2000 09:51:06 -0700 X-Authentication-Warning: cylinder.csl.sri.com: filliatr set sender to filliatr@cylinder.csl.sri.com using -f From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14572.49274.910966.673172@cylinder.csl.sri.com> Date: Thu, 6 Apr 2000 09:51:06 -0700 (PDT) To: "Dennis (Gang) Chen" Cc: "caml-list@inria.fr" Subject: Re: When functional languages can be accepted by industry? In-Reply-To: <38E7F364.5D24BB7C@motorola.com> References: <38E7F364.5D24BB7C@motorola.com> X-Mailer: VM 6.62 under Emacs 20.4.1 Reply-To: filliatr@csl.sri.com (Jean-Christophe Filliatre) Resent-From: weis@pauillac.inria.fr Resent-Date: Mon, 10 Apr 2000 01:31:23 +0200 Resent-To: caml-redistribution@pauillac.inria.fr In his message of Mon April 3, 2000, Dennis (Gang) Chen writes: > Are there other features of functional language which will attract industry? - Garbage Collection. (how many memory leaks in C++ programs? how many bugs related to memory unsafely de-allocated?) And ocaml's GC is a very good one. - Strong Typing. (how many bugs are related to unsafe type assumptions about pointers in other languages?) Above all, strong typing allows you to develop and experiment with your code very quickly. Let me explain that point. When you add a constructor to a type, or when you change the definition of a type, or the type of a function, you just have to recompile and the compiler will find all the places which are now ill-typed, or where a pattern-matching is non-exhaustive, etc. and this is possible because of strong-typing. In practice, it appears to be one of the most important property of ocaml's compiler. I use it hundreds of times every day. Whatever the size and the complexity of your code are, the compiler will find the needed changes. With other languages, you have to think hard to remember the places where changes are now needed, and that's a reason for code inertia (and for bugs, too). - Recursive data-types. I didn't follow your arguments about C++ STL versus lists in functional programming. Of course, lists are almost always bad data-structures. But a good functional programmer does not use lists as data-structures (a Lisp programmer, may be :-) but rather balanced trees, Patricia trees, binomial heaps, hash-tables, etc. Moreover, most of these datatypes are persistent, an essential property is several applications (whether in-place destructive datastructures require explicit copies, which are time and space consuming). You should read Chris Okasaki's book "Purely Functional Data Structures". Strong typing, recursive data-types and a good GC are essential tools for the programmer: you develop quicker, your code is safer (does not crash on a seg fault) and is easier to maintain and to modify. Do you still need other arguments? -- Jean-Christophe Filliatre Computer Science Laboratory Phone (650) 859-5173 SRI International FAX (650) 859-2844 333 Ravenswood Ave. email filliatr@csl.sri.com Menlo Park, CA 94025, USA web http://www.csl.sri.com/~filliatr