From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4F831D45F for ; Tue, 1 Nov 2005 09:17:27 +0100 (CET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jA18HObr005414 for ; Tue, 1 Nov 2005 09:17:26 +0100 Received: from rosella (ppp7-104.lns1.syd7.internode.on.net [59.167.7.104]) by smtp1.adl2.internode.on.net (8.12.9/8.12.6) with ESMTP id jA18H1EJ016948; Tue, 1 Nov 2005 18:47:06 +1030 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] Stdlib From: skaller To: Jonathan Roewen Cc: caml-list@yquem.inria.fr In-Reply-To: References: <1130769705.488.16.camel@starlight> <1130779215.11424.21.camel@rosella> Content-Type: text/plain Date: Tue, 01 Nov 2005 19:17:01 +1100 Message-Id: <1130833021.7552.60.camel@rosella> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 43672494.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 stdlib:01 non-trivial:01 haskell:01 ocaml:01 polymorphism:01 haskell:01 ocaml:01 functors:01 monadic:01 notation:01 ocaml's:01 functors:01 functor:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 2005-11-01 at 13:11 +1300, Jonathan Roewen wrote: > > All of this can be done (I worked on a system that did it), > > however it is definitely non-trivial. It is well in advance > > of anything Haskell can do also. > > Really? Really. It is in some sense the Holy Grail of programming language design. Ocaml doesn't even support higher order polymorphism -- you cannot pass a polymorphic function to a function -- when you try it gets monomorphised (yes, it can be done by wrapping the function in a record or using classes). > What about type classes? Haskell has fmap! That's an example > of what you mean, correct? Yes, it is an example of what one would like to do, however it is not the same. You have to provide certain primitives, and then others are derived from them. The problem is .. this is nominal typing. In fact, Ocaml can do this same thing with functors, but the result is merely a sum of all the named cases -- it isn't abstract. Haskell makes it easier to name the types (monadic notation) but it isn't any more expressive than Ocaml's functors. In fact, it is probably the other way around, its just that instantiating all those dang functors by hand is a pain. C++ is a breeze by comparison, since templates are instantiated automatically. The point is that the much vaunted 'intensional polymorphism' in Ocaml only applies to type variables -- there are no functor variables. BTW: any real type theorist disgusted with my explanation is welcome to explain it properly -- in particular why it is THE central problem of programming theory. -- John Skaller Felix, successor to C++: http://felix.sf.net