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=2.0 required=5.0 tests=AWL,HTML_10_20,HTML_MESSAGE, 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 BDB9EBC69 for ; Thu, 8 Mar 2007 22:05:51 +0100 (CET) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.190]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l28L5pcd008275 for ; Thu, 8 Mar 2007 22:05:51 +0100 Received: by mu-out-0910.google.com with SMTP id w9so735672mue for ; Thu, 08 Mar 2007 13:05:51 -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:references; b=Xis7jQH+wRlE8MuKdjJf/oLj+HlZqpifGkzqJiu80tczJ2+/Y/uVGgfYfmwlL6VJV2XXW1uOwk7nAcVOQnUpoEO3S/07Muf3bdNAb5lvK92qjzmrGFA3AdJZ+yyD+nW3IHo1Cezld+i//93mEzGUqbCdMDV2znzDMSVtN8pxuf4= 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:references; b=X0OQgz90eNDyqacdzYVtPSeasdBBZ8fxGSc8TxO/OoNiFo/+yRoKdfzxfRJZiLmg2XRlJQjIYvou9kch9SjELUYMMobFeGwDcdl3DsSHta10wC1pdpYOCt4cU/GAySgBGpWqSeAxi3cMYc6MiMOfokRRE7FbYSTIUL4+30Vk3bA= Received: by 10.82.114.3 with SMTP id m3mr1528562buc.1173387950887; Thu, 08 Mar 2007 13:05:50 -0800 (PST) Received: by 10.82.100.16 with HTTP; Thu, 8 Mar 2007 13:05:50 -0800 (PST) Message-ID: Date: Thu, 8 Mar 2007 22:05:50 +0100 From: Tom To: "Robert Fischer" Subject: Re: [Caml-list] Operator overloading Cc: caml-list@yquem.inria.fr In-Reply-To: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB74@selma.roomandboard.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_205452_21999675.1173387950786" References: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB74@selma.roomandboard.com> X-j-chkmail-Score: MSGID : 45F07AAF.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45F07AAF.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 notation:01 overloading:01 pointers:01 vectors:01 matrices:01 ocaml:01 polymorphism:01 notation:01 pointers:01 vectors:01 matrices:01 ocaml:01 polymorphism:01 herself:98 X-Attachments: cset="UTF-8" cset="UTF-8" ------=_Part_205452_21999675.1173387950786 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 08/03/07, Robert Fischer wrote: > > > When I see "+", I want to know what that means. > I disagree and I couldn't disagree more. In mathematics, we're perfectly ?!? using + for integer, float, complex, vector and matrix addition (and the combinations of them) and * for integer, float, complex, vector, vector and scalar, and matrix multiplication. One who doesn't understand what the "code" - mathematical notation - means should blame oneself for not understanding the algorithm, not the "designer" for making the "language" - mathematical conventions - unappropriate. 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. Like a saying for magic goes, "There is no black magic or white magic, there is only magic. It's classification depends on the intentions of the caster!" Any tool given to a programmer can be used either to his advantage or disadvantage. Even in the "best" language, a stupid programmer will programm poor algorithms, so there is no point protecting the programmer from himself (or herself). Hence, one can hardly say overloading (in general, not only operator overloading) is bad in C++. If designed carefuly and mantained with a bit of common sense, it can result in enormous productivity gain. And, how often does it happen that you don't know what a particular operation means in a three-lines-long numerical calculation involving vectors, floats and matrices? Anyhow, if you DID get lost, then you would equally lose yourself in a mess of *|, +\, %, -| and /. operators. You don't want OCaml be named LISO - Lost In Superfluous Operators. I believe that operator overloading an d overloading in general can result in great productivity and readability gain. Also, they can improve polymorphism. For example, does it matter if you can't figure out the type of a in length a? Actually, it doesn't - it could be a list, an array, a dynarray, a train or a snake - as long as it "fits" algorithmically, it can be anything. - Tom ------=_Part_205452_21999675.1173387950786 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On 08/03/07, Robert Fischer <RFischer@roomandboard.com> wrote:

When I see "+", I want to know what that means.

I disagree and I couldn't disagree more. In mathematics, we're perfectly ?!? using + for integer, float, complex, vector and matrix addition (and the combinations of them) and * for integer, float, complex, vector, vector and scalar, and matrix multiplication. One who doesn't understand what the "code" - mathematical notation - means should blame oneself for not understanding the algorithm, not the "designer" for making the "language" - mathematical conventions - unappropriate.

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.

Like a saying for magic goes, "
There is no black magic or white magic, there is only magic. It's classification depends on the intentions of the caster!" Any tool given to a programmer can be used either to his advantage or disadvantage. Even in the "best" language, a stupid programmer will programm poor algorithms, so there is no point protecting the programmer from himself (or herself).

Hence, one can hardly say overloading (in general, not only operator overloading) is bad in C++. If designed carefuly and mantained with a bit of common sense, it can result in enormous productivity gain. And, how often does it happen that you don't know what a particular operation means in a three-lines-long numerical calculation involving vectors, floats and matrices? Anyhow, if you DID get lost, then you would equally lose yourself in a mess of *|, +\, %, -| and /. operators. You don't want OCaml be named LISO - Lost In Superfluous Operators.

I believe that operator overloading an d overloading in general can result in great productivity and readability gain. Also, they can improve polymorphism. For example, does it matter if you can't figure out the type of a in length a? Actually, it doesn't - it could be a list, an array, a dynarray, a train or a snake - as long as it "fits" algorithmically, it can be anything.

- Tom
------=_Part_205452_21999675.1173387950786--