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 8DD75BC69 for ; Fri, 9 Mar 2007 00:51:11 +0100 (CET) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l28Np8gf008243 for ; Fri, 9 Mar 2007 00:51:10 +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 10:21:08 +1030 X-IronPort-AV: i="4.14,264,1170595800"; d="scan'208"; a="60069774:sNHT35576317" Subject: RE: [Caml-list] Operator overloading From: skaller To: Robert Fischer Cc: caml-list@yquem.inria.fr In-Reply-To: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB74@selma.roomandboard.com> References: <3D1E4D9CA9BCE04D8F2B55F203AE4CE30666AB74@selma.roomandboard.com> Content-Type: text/plain Date: Fri, 09 Mar 2007 10:51:04 +1100 Message-Id: <1173397864.6613.49.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45F0A16C.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; overloading:01 overloading:01 ocaml:01 ocaml:01 functors:01 functors:01 stl:01 abstraction:01 compiler:01 sourceforge:01 hacks:01 wrote:01 dynamically:01 clearer:01 typing:01 On Thu, 2007-03-08 at 14:02 -0600, Robert Fischer wrote: > When I see "+", I want to know what that means. With operator overloading, I don't know. This argument is fallacious: When you see + you know it means addition of whatever argument types are used. Addition is well understood. The structure of the types is not distinct. The problem is that Ocaml doesn't provide sufficiently powerful system to easily encapsulate this structure. Addition is a bad example because it's somewhat questionable. It is clearer if we talk of map, fold, and other such operations which are clearly polyadic operators. Overloading eases the burden of a weakness in the language, not providing polyadic map and fold. In fact Ocaml functors just provide overloading, because they only work for finite manual instantiations. They don't provide genunine polyadic programming. FISh 1 is a polyadic array programming language, you can do algorithms which are independent of rank (number of dimensions). In that language, map and fold only need ONE definition and then work on all data types. BOTH Ocaml functors and overloading are just hacks to work around the lack of ability to properly express higher order natural transformations. C++ provides polyadic behaviour: the whole of STL is based on it, it just doesn't do it the right way. The thing to understand is that a lot of programming is experimental and/or loose: a lot of code is actually written in dynamically typed scripting languages. For systems like Ocaml, you need a mix of sloppiness and heavy typing, because unless you're implementing a well understood mathematical formalism, too much formality and abstraction just gets in the way. For example if you were implementing a C++ compiler in Ocaml I'm going to bet you'd want plenty of space to fiddle with your representations and concepts, because you don't quite know what it is you're actually implementing. -- John Skaller Felix, successor to C++: http://felix.sf.net