Re: When functional languages can be accepted by industry?

From: Jean-Christophe Filliatre (filliatr@csl.sri.com)
Date: Thu Apr 06 2000 - 18:51:06 MET DST

  • Next message: Hao-yang Wang: "Re: to have labels or not"

    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
    



    This archive was generated by hypermail 2b29 : Mon Apr 10 2000 - 01:34:36 MET DST