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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 6F5EBBC69 for ; Fri, 9 Mar 2007 10:24:17 +0100 (CET) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l299OEPs011735 for ; Fri, 9 Mar 2007 10:24:16 +0100 Received: from ppp19-103.lns2.syd7.internode.on.net (HELO [192.168.1.201]) ([59.167.19.103]) by ipmail03.adl2.internode.on.net with ESMTP; 09 Mar 2007 19:54:12 +1030 X-IronPort-AV: i="4.14,267,1170595800"; d="scan'208"; a="60318344:sNHT22477917" Subject: Re: [Caml-list] Operator overloading From: skaller To: Tom Cc: caml-list@yquem.inria.fr, Robert Fischer In-Reply-To: References: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB74@selma.roomandboard.com> <1173397864.6613.49.camel@rosella.wigram> Content-Type: text/plain Date: Fri, 09 Mar 2007 20:24:11 +1100 Message-Id: <1173432251.22738.2.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45F127BE.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 0100,:01 ocaml:01 functors:01 overloading:01 vectors:01 matrices:01 axioms:01 elt:01 sourceforge:01 sourceforge:01 hacks:01 wrote:01 wrote:01 caml-list:01 On Fri, 2007-03-09 at 08:23 +0100, Tom wrote: > > > On 09/03/07, skaller wrote: > > BOTH Ocaml functors and overloading are just hacks to > work around the lack of ability to properly express > higher order natural transformations. > > Hm... indeed, but for some operations, you cannot provide a single, > general definition - say for length operation, or for * (* is very > different when it comes to scalars, vectors and matrices - not even > the same axioms hold). I believe that the basic operations should be > implemented using overloading (actually, some smart overloading that > would allow both static and (seemingly) dynamic resolving) and then > polyadic operations be built on top of that. Actually, length can be defined in turns of fold: let len x = fold (fun acc elt -> acc + 1) 0 container -- John Skaller Felix, successor to C++: http://felix.sf.net