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.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id C93DEBC69 for ; Fri, 9 Mar 2007 14:52:45 +0100 (CET) Received: from triton.rz.uni-saarland.de (triton.rz.uni-saarland.de [134.96.7.25]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l29Dqjj2005223 for ; Fri, 9 Mar 2007 14:52:45 +0100 Received: from uni-sb.de (uni-sb.de [134.96.7.230]) by triton.rz.uni-saarland.de (8.12.11.20060614/8.12.10) with ESMTP id l29DqivX4004245 for ; Fri, 9 Mar 2007 14:52:44 +0100 (CET) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by uni-sb.de (8.14.0/2007012900) with ESMTP id l29Dqirj025874 for ; Fri, 9 Mar 2007 14:52:44 +0100 (CET) Received: from mail.ps.uni-sb.de (james.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.14.0/2007012900) with ESMTP id l29Dqhhr008359 for ; Fri, 9 Mar 2007 14:52:43 +0100 (CET) Received: from groove.ps.uni-sb.de ([134.96.186.112]) by mail.ps.uni-sb.de with esmtp (Exim 4.50) id 1HPfWU-0007R9-MQ for caml-list@inria.fr; Fri, 09 Mar 2007 14:52:43 +0100 Message-ID: <45F166AA.9090005@ps.uni-sb.de> Date: Fri, 09 Mar 2007 14:52:42 +0100 From: Andreas Rossberg User-Agent: Thunderbird 1.5.0.5 (X11/20060812) MIME-Version: 1.0 To: caml-list@inria.fr References: <20070309073658.8F020AD34@Adric.metnet.fnmoc.navy.mil> <1173438574.22738.24.camel@rosella.wigram> In-Reply-To: <1173438574.22738.24.camel@rosella.wigram> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 134.96.186.112 X-SA-Exim-Mail-From: rossberg@ps.uni-sb.de Subject: Re: [Caml-list] Operator overloading X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100) X-SA-Exim-Scanned: Yes (on mail.ps.uni-sb.de) X-AntiVirus: checked by AntiVir Milter (version: 1.1.3-1; AVE: 7.3.1.38; VDF: 6.37.1.190; host: AntiVir1) X-Miltered: at discorde with ID 45F166AD.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; rossberg:01 rossberg:01 overloading:01 haskell:01 existential:01 oleg's:01 vaguely:01 orthogonal:01 mutable:01 model:01 subtyping:01 wrote:01 syntactic:01 typing:01 caml-list:01 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. Ignoring implementation inheritance, I claim that in combination with existential types, even relatively basic type classes are strictly more powerful than OO classes (modulo some lack of syntactic sugar). Have a look at Oleg's paper. > C++ classes can also provide state and inheritance. > The state looks vaguely like dependent typing to me .. :) I grant you (implementation) inheritance, but I don't understand the rest of your comment. State is orthogonal to classes. Surely you can define a type class that contains a, say, IORef (for per-class state). Likewise, you can instantiate type classes to stateful types (as the equivalent to per-object (mutable) state). > OK, so now we have a much more powerful model .. I don't think so. > yet > it has known limitations, in particular the so-called > 'covariance' problem prevents OO from modelling any > serious kind of system: for example a system > with binary operators doesn't admit an OO representation. Which is one of the problems type classes do not have, because qualified types *are* more expressive than subtyping in that respect. AFAICS, the rest of your argument hence does not follow. -- Andreas Rossberg, rossberg@ps.uni-sb.de