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 329A0BBCA for ; Fri, 9 May 2008 03:11:33 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0CAEZBI0jR4q82f2dsb2JhbACBU5AzAQELBQIGBxGZVw X-IronPort-AV: E=Sophos;i="4.27,457,1204498800"; d="asc'?scan'208";a="10530966" Received: from tomts10-srv.bellnexxia.net ([209.226.175.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 May 2008 03:11:32 +0200 Received: from toip7.srvr.bell.ca ([209.226.175.124]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20080509011131.FCTE1721.tomts10-srv.bellnexxia.net@toip7.srvr.bell.ca> for ; Thu, 8 May 2008 21:11:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAPtBI0hMQkWW/2dsb2JhbACBU6o4 Received: from bas10-kitchener06-1279411606.dsl.bell.ca (HELO neptune.mattcox.ca) ([76.66.69.150]) by toip7.srvr.bell.ca with ESMTP; 08 May 2008 21:14:24 -0400 Received: from matt by neptune.mattcox.ca with local (Exim 4.69) (envelope-from ) id 1JuH93-0001Fr-Bj for caml-list@yquem.inria.fr; Thu, 08 May 2008 21:11:33 -0400 Date: Thu, 8 May 2008 21:11:33 -0400 From: Matthew William Cox To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Why OCaml sucks Message-ID: <20080509011133.GA4766@neptune.mattcox.ca> References: <200805090139.54870.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline In-Reply-To: <200805090139.54870.jon@ffconsultancy.com> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Spam: no; 0.00; ocaml:01 0100,:01 advocates:01 functor:01 functors:01 mutable:01 mutable:01 haskell:01 lacks:01 haskell's:01 mutation:01 fairness:01 polymorphism:01 shift-reduce:01 ocaml's:01 X-Attachments: type="application/pgp-signature" name="signature.asc" --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 09, 2008 at 01:39:54AM +0100, Jon Harrop wrote: > Brian Hurt recently published... >=20 > 3. Lack of multi-file modules: I have never found this to be a > problem. Nor do I find filenames implying module names to be a > problem, as many SML advocates seem to believe (yes, both of them ;-). I would add a 3a: the inability to have a "root"-level functor. As it stands, all functors are (sometimes naturally, sometimes not) embedded in a "root" module. I'm looking at you, Map.Make. You too, Set.Make. > 4. Mutable data: I believe the exact opposite. The ability to drop down t= o=20 > mutable data structures for performance without leaving the language is= =20 > essential and the ability to predict memory consumption is essential, bot= h of=20 > which Haskell lacks. Consequently, Haskell's inability to handle mutation= =20 > efficiently and safely have doomed it to failure for practical applicatio= ns. Well, in fairness, there's always the ST monad. However, the rank-2 polymorphism involved is nontrivial, and I agree with you [Jon.] > 5. Strings: pushing unicode throughout a general purpose language is a=20 > mistake, IMHO. This is why languages like Java and C# are so slow. This is simply ridiculous. Using heavy-weight unicode-aware functions for character operations may slow down string-intensive operations in those languages, but the only alternative is to be broken. See items 3 and 4 here: http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html In both cases, we need locale-aware character processing. That means Unicode these days. Unless you code your own routines for processing every 8-bit character set out there. I don't. > 6. Shift-reduce conflicts: although there as aspects of OCaml's syntax th= at I=20 > would like to tweak (e.g. adding an optional "end" after a "match"=20 > or "function" to make them easier to nest), I am not bother about the=20 > shift-reduce conflicts. Mainstream languages get by with far more serious= =20 > syntactic issues (like <<...>> in C++). I've been bitten by exactly these sorts of problems. Sometimes I get an obscure type error, sometimes I don't. I've just gotten used to not placing a match-like construct in the middle of a sequence expression when I can avoid it. > 8. Exceptions: I love OCaml's extremely fast exception handling (6x faste= r=20 > than C++, 30x faster than Java and 600x faster than C#/F#!). I hate=20 > the "exceptions are for exceptional circumstances" line promoted by the= =20 > advocates of any language implementation with cripplingly-slow exception= =20 > handlers. I really miss fast exception handling in F#. Brian gives an exa= mple=20 > of exception handling with recursive IO functions failing to be tail=20 > recursive here and advocates option types. But recursion is the wrong too= l=20 > for the job here and option types are even worse. You should use mutation= =20 > and, failing that, CPS. I suspect his reaction to exceptions comes from an unfamiliarity with their uses in Ocaml. In C++/Java land, the gospel is to only use them for exceptional circumstances. In the case of C++, this is probably because of the difficulty of writing exception-safe code: if you're going to throw an exception, your code is likely going to be broken as a result. As a result, exceptions seem to be reserved for situations where normal processing must terminate anyways. > 9. Deforestation: Brian says "Haskell has introduced a very interesting a= nd=20 > (to my knowledge) unique layer of optimization, called deforrestation". T= rue,=20 > of course, but useless theoretical piffle because we know that Haskell is= =20 > slow in practice and prohibitively difficult to optimize to-boot. Defores= ting=20 > is really easy to do by hand. Yes, its easy to do by hand. It's also time consuming. Don't you make a living off ocaml? I'm surprised you can justify using your time on such a mechanical task. Granted, deforesting something like map f . map g into map (f . g) is trivial, but we can come up with both trivial and nontrivial examples for almost anything. Cheers, Matt --SLDf9lqlvOQaIe6s Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFII6TFLzoc++7UJR8RAhZSAJ4tgZtSvwzoL/0pftdRJrntjFydVACgrdeF spqsGdGWPmkGOn0wvhhLw08= =j054 -----END PGP SIGNATURE----- --SLDf9lqlvOQaIe6s--