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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 52732BC69 for ; Thu, 8 Mar 2007 23:25:01 +0100 (CET) Received: from sark4.cc.gatech.edu (sark4.cc.gatech.edu [130.207.7.19]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l28MP06r025030 for ; Thu, 8 Mar 2007 23:25:00 +0100 Received: from gaia.cc.gatech.edu (gaia.cc.gatech.edu [130.207.3.8]) by sark4.cc.gatech.edu (8.13.6/8.12.8) with ESMTP id l28MOtK1020461; Thu, 8 Mar 2007 17:24:57 -0500 (EST) Received: (from fernando@localhost) by gaia.cc.gatech.edu (8.13.6/8.12.8) id l28MOtCh012023; Thu, 8 Mar 2007 17:24:55 -0500 (EST) Date: Thu, 8 Mar 2007 17:24:55 -0500 From: Fernando Alegre To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Operator overloading Message-ID: <20070308222455.GB13653@gaia.cc.gatech.edu> References: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB5E@selma.roomandboard.com> <45F04DD0.5010505@janestcapital.com> <200703081940.42856.jon@ffconsultancy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200703081940.42856.jon@ffconsultancy.com> User-Agent: Mutt/1.4.2.1i X-Miltered: at discorde with ID 45F08D3C.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 overloading:01 functors:01 ocaml:01 wrote:01 caml-list:01 int:01 modules:02 explicit:03 implicit:03 let:03 let:03 expressions:04 thu:05 vector:05 On Thu, Mar 08, 2007 at 07:40:42PM +0000, Jon Harrop wrote: > For me, operator overloading is about clarity. In the absence of operator > overloading, you cannot regain the lost clarity using modules and functors. I often use the poor man's local operator overloading already built into the core OCaml: let result = let (+) = Vector.add and ( * ) (x:int) (v:Vector.t) = Vector.scalarmul x v in 3 * a + 2 * b This makes overloading local and explicit, and at the same time makes expressions clear. I do not miss implicit overloading. Fernando