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 4D4DBBC69 for ; Fri, 9 Mar 2007 00:20:02 +0100 (CET) Received: from mail.roomandboard.com (mail.roomandboard.com [66.84.219.55]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l28NK0Pn003633 for ; Fri, 9 Mar 2007 00:20:01 +0100 Received: from selma.roomandboard.com ([192.168.101.46]) by mail.roomandboard.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 8 Mar 2007 17:20:00 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Operator overloading Date: Thu, 8 Mar 2007 17:20:00 -0600 Message-ID: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB80@selma.roomandboard.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] Operator overloading Thread-Index: Acdh2EsmiTjfCY9kTsCEvjGKwIbDhA== From: "Robert Fischer" To: X-OriginalArrivalTime: 08 Mar 2007 23:20:00.0545 (UTC) FILETIME=[4B2D7910:01C761D8] X-Miltered: at discorde with ID 45F09A20.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 overloading:01 functors:01 ocaml:01 beginner's:01 ocaml:01 bug:01 beginners:01 wrote:01 caml-list:01 caml-list:01 int:01 bin:01 modules:02 caml:02 I didn't realize that existed. It's not so bad -- it lets me have my cake and Jon eat it, too. :D ~~ Robert. -----Original Message----- From: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inria.fr]On Behalf Of Fernando Alegre Sent: Thursday, March 08, 2007 4:25 PM To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Operator overloading 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=20 > 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 =3D let (+) =3D Vector.add and ( * ) (x:int) (v:Vector.t) =3D 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 _______________________________________________ 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