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=AWL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id E2B0FBC69 for ; Thu, 9 Nov 2006 09:51:33 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kA98pVQL015788 for ; Thu, 9 Nov 2006 09:51:32 +0100 Received: from ppp39-78.lns2.syd6.internode.on.net (HELO rosella) ([59.167.39.78]) by ipmail02.adl2.internode.on.net with ESMTP; 09 Nov 2006 19:21:22 +1030 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAJZ5UkU7pydO/2dsb2JhbAA X-IronPort-AV: i="4.09,403,1157293800"; d="scan'208"; a="43362381:sNHT405263026" Subject: Re: [Caml-list] parameterized pattern From: skaller To: Jon Harrop Cc: caml-list@yquem.inria.fr In-Reply-To: <200611090519.45998.jon@ffconsultancy.com> References: <454FA5F8.5030106@hq.idt.net> <4a708d20611081555i1f860911rfb7a29d31a34ce7a@mail.gmail.com> <200611090519.45998.jon@ffconsultancy.com> Content-Type: text/plain Date: Thu, 09 Nov 2006 19:51:20 +1100 Message-Id: <1163062280.28049.110.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4552EC13.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 extensional:01 polymorphism:01 gcaml:01 ocaml:01 extensional:01 polymorphism:01 overloading:01 typeclass:01 constructors:01 typeclass:01 functors:01 coupling:01 sourceforge:01 polymorphic:01 On Thu, 2006-11-09 at 05:19 +0000, Jon Harrop wrote: > On Thursday 09 November 2006 01:45, brogoff wrote: > > It's a pity, as I've often wished that OCaml supported the extensional > > polymorphism that GCaml has, but I don't think that's going to happen. > > It would probaby make more sense to create a separate language at this > > point, since OCaml is complicated enough. > > I think F# provides some form of extensional polymorphism. I'm not convinced > that it is a good idea yet... Well FYI Felix has traditional (open) overloading, but since it doesn't allow traditional C++ style dependent name lookup because that would destroy parametricity of polymorphic functions, something else was needed. So it now has first order typeclasses to solve this problem. [By first order I mean typeclass arguments can be types but not type constructors, i.e. it only supports data polymorphism, not functorial polymorphism/polyadic programming] This allows you to write stuff like this: typeclass Integer[t] { virtual fun add: t * t -> t; } fun sum3[t where Integer[t]] (x:t,y:t,z:t)=> add(x,add(y,z)); print (sum3(1,2,3)); instance Integer[int] { fun add: int * int -> int = "$1+$2"; // C code } open Integer[int]; print (add(add(1,2),3)); I'm not sure i really like typeclasses much, ML functors seem more general, and the coupling is explicit. -- John Skaller Felix, successor to C++: http://felix.sf.net