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 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 69633BC69 for ; Fri, 9 Mar 2007 16:07:58 +0100 (CET) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l29F7tCj027770 for ; Fri, 9 Mar 2007 16:07:57 +0100 Received: from ppp19-103.lns2.syd7.internode.on.net (HELO [192.168.1.201]) ([59.167.19.103]) by ipmail03.adl2.internode.on.net with ESMTP; 10 Mar 2007 01:37:54 +1030 X-IronPort-AV: i="4.14,268,1170595800"; d="scan'208"; a="60401352:sNHT46391401" Subject: Re: [Caml-list] Operator overloading From: skaller To: Andreas Rossberg Cc: caml-list@inria.fr In-Reply-To: <45F166AA.9090005@ps.uni-sb.de> References: <20070309073658.8F020AD34@Adric.metnet.fnmoc.navy.mil> <1173438574.22738.24.camel@rosella.wigram> <45F166AA.9090005@ps.uni-sb.de> Content-Type: text/plain Date: Sat, 10 Mar 2007 02:07:51 +1100 Message-Id: <1173452871.22738.91.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45F1784B.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 0100,:01 rossberg:01 haskell:01 oleg's:01 ocaml:01 abstraction:01 haskell:01 model:01 covariance:01 sourceforge:01 wrote:01 wrote:01 typing:01 caml-list:01 On Fri, 2007-03-09 at 14:52 +0100, Andreas Rossberg wrote: > skaller wrote: > > > > It's hard to say, because in OO terms Haskell typeclasses > > are so weak it's surprising they're any use at all. > > Not sure how you come to that conclusion. Both concepts are somewhat > incomparable, but there are a number of axes along which type classes > are much more expressive than OO classes. I'm sorry to write so poorly. This isn't the comparison I'm drawing. Consider *implementing* typeclasses with records, as in Oleg's Ocaml examples. Ok, now replace the records with classes. Classes are more powerful because they provide (a) state (b) inheritance etc They also don't make the weak assumption of an abstraction (possibly with default methods as in Haskell) and a single instantiation: in C++ at least you can have sequence of more derived classes. So the type model associated with this implementation can do more than the one just using plain records: records aren't typeclasses, so the class based implementation can't be compared with them: records classes typeclasses ??????? Clearly ???? is more expressive than typeclasses, whatever it is .. I am guessing the state of the classes provides dependent typing but I don't really know. Anyhow my ARGUMENT was actually that using classes subsumes plain old records .. and classes are limited by the covariance problem, so records must be limited too. -- John Skaller Felix, successor to C++: http://felix.sf.net