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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL 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 94B36BC69 for ; Thu, 8 Mar 2007 23:35:01 +0100 (CET) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.233]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l28MZ0wG029037 for ; Thu, 8 Mar 2007 23:35:01 +0100 Received: by nz-out-0506.google.com with SMTP id r28so531629nza for ; Thu, 08 Mar 2007 14:34:57 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=XZk0QraE3FkuwoLlJ+n6iu8HIBWcciPnBwpLE+ZYnayrEFQiIDD8OY9MaJ7c+bYigYprRrF4iDy0Tuw3efK/V18t/QwwsWo+SzKQlBqRF2YUoNd8B6V3VdB8sdATaH9iuGXY4huDm+htSWdn+FfWKEs17Sj0tYjGC7Fcs14GFFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=aFN96EUGiZz5fQtz8tDIogTvC9lHMoNvOo4hhIkouBzsi9hzjpxKxnFN1IwkcOey0Bo3Oj0HEGotVL08k2+zbsdqNjnT9iGgwE6gCuL/pH3FRnlf2HkMZjgn29Tcbmve2nq9nGhFZAtfKB1yklDpBvqnUbQs+0xfn7ANw0z7ZOo= Received: by 10.64.195.20 with SMTP id s20mr1665728qbf.1173393297691; Thu, 08 Mar 2007 14:34:57 -0800 (PST) Received: by 10.65.98.10 with HTTP; Thu, 8 Mar 2007 14:34:57 -0800 (PST) Message-ID: <9d3ec8300703081434r6e4987d0l5f737d873f65d9ee@mail.gmail.com> Date: Thu, 8 Mar 2007 23:34:57 +0100 From: "Till Varoquaux" To: "Brian Hurt" Subject: Re: [Caml-list] Operator overloading Cc: Tom , caml-list@yquem.inria.fr, "Robert Fischer" In-Reply-To: <45F080C8.3070307@janestcapital.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB74@selma.roomandboard.com> <45F080C8.3070307@janestcapital.com> X-j-chkmail-Score: MSGID : 45F08F94.003 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45F08F94.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 lambda:01 verbose:01 functor:01 ad-hoc:01 polymorphism:01 overloading:01 haskell:01 monads:01 functor:01 compiler:01 compilation:01 g'caml:01 extensional:01 polymorphism:01 Hum... Instead of proving once again Godwin's law we might want to use constructive criticism (even though I also tend to flame more than my share)... There have been many articles relating type classes and ML module system. Lambda the Ultimate has link to quite a share of them. Swapping type classes for modules forces you to be more explicit and verbose. Indeed you would have to wrap your code in a functor whenever you want ad-hoc polymorphism (aka overloading) to occur. This can prove quite cumbersome. Haskell relies heavily on type classes, monads would be much more painful if you had to wrap them in a functor. Overloading, however, does come with a cost: the compiler cannot get rid of all type information: sometime (e.g. separate compilation) the right monomorphic function can only be done dynamically. G'Caml brings extensional polymorphism (types as first class values) to OCaml. Extensional polymorphism allows run time type introspection thus allowing overloading... whether you like it or not is a matter of personal taste. Till P.S. FYI I happen to like type classes and exceptions. I do know there are also good reasons not to and I respect other opinions. On 3/8/07, Brian Hurt wrote: > Tom wrote: > > > > > Albeit Brian Hurt's comment about operator overloading making more > > harm than good in C++, I believe that overloading simply has to be > > used appropriately - it's like saying pointers are bad because they > > can introduce memory leaks and null references, and division is bad > > because it can raise Division_by_zero exceptions. > > > So maybe we should introduce pointers into Ocaml? > > Brian > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >