From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA25113; Thu, 20 Nov 2003 08:37:52 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA25316 for ; Thu, 20 Nov 2003 08:37:51 +0100 (MET) Received: from mail.davidb.org (adsl-64-172-240-129.dsl.sndg02.pacbell.net [64.172.240.129]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hAK7bo102047 for ; Thu, 20 Nov 2003 08:37:50 +0100 (MET) Received: from davidb by mail.davidb.org with local (Exim 3.36 #1 (Debian)) id 1AMjNj-0000iq-00; Wed, 19 Nov 2003 23:37:39 -0800 Date: Wed, 19 Nov 2003 23:37:39 -0800 From: David Brown To: skaller Cc: Brian Hurt , Ville-Pertti Keinonen , Caml Mailing List Subject: Re: [Caml-list] GC and file descriptors Message-ID: <20031120073739.GA2720@davidb.org> References: <1069305275.24578.57.camel@pelican> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1069305275.24578.57.camel@pelican> User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 caml-list:01 1100,:01 haskell:01 deallocated:01 haskell:01 liveness:01 closures:01 closures:01 compilers:01 ocaml:01 ocaml:01 descriptors:01 interfaces:01 nov:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Nov 20, 2003 at 04:14:36PM +1100, skaller wrote: > Whilst you can do that in a strict language like > Ocaml I would guess it is (at least a bit more) > *automatic* in a lazy language like Haskell. > > I guess that would be a major productivity > and performance boost -- the code is easier > to write, and far less memory is required > (since for example only a small local part > of a list will exist at any time, the not > yet needed part is not yet built, and the > already used part is not reachable and > thus deallocated). My brief experience with Haskell: - The lazy evaluation is very helpful, precisely for what you describe. Code has the potential to be clearer, since interfaces are simpler. Time need not be specified. - I also found it is easy to create space leaks, and very hard to find them. Since flow is not specified directly in the language, I found it difficult to develop an intuition for liveness. - The lazy evaluation is a performance hit, but a fairly constant one. The good compilers tend to write strict code for small cases, but large portions of the code run a lazy fashion. This adds quite a bit of burden to the GC as well. Essentially, most data structures include closures for computing results. There is extra overhead to evaluate the closures, as well as the necessity to allocate/collect the data associated with them. I do periodically go back to Haskell, because there is just something neat feeling about it. But, I have not encountered a language that is so intuitive to program as Ocaml. Dave ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners