From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA04862; Mon, 15 Apr 2002 15:10:12 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA15244 for caml-list@pauillac.inria.fr; Mon, 15 Apr 2002 15:10:11 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA22411 for ; Sat, 13 Apr 2002 15:58:13 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from sj1-3-4-9.securesites.net (sj1-3-4-9.securesites.net [192.220.127.202]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id g3DDwCL13078 for ; Sat, 13 Apr 2002 15:58:13 +0200 (MET DST) Received: (qmail 93975 invoked by uid 16863); 13 Apr 2002 13:58:10 -0000 Received: from unknown (HELO localhost) ([192.220.65.223]) (envelope-sender ) by 192.220.65.223 (qmail-ldap-1.03) with SMTP for ; 13 Apr 2002 13:58:10 -0000 Date: Sat, 13 Apr 2002 13:58:10 +0000 (GMT) From: Brian Rogoff To: William Chesters cc: caml-list@inria.fr Subject: Re: [Caml-list] operator overloading In-Reply-To: <15543.61656.841585.602588@beertje.william.bogus> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 13 Apr 2002, William Chesters wrote: > Issac Trotts writes: > > Looking at the Google results, operator overloading has come up > > as a frequently discuseed topic. Overloading has been discussed frequently, and it is a very desired feature by some (including me!) and a much less desired feature by others. "Operator overloading" is a funny term. You can rebind infix operators but you don't get overloading. Try out G'Caml if you want to get the flavor of the proposed Caml approach. It's experimental, and I doubt it will be merged in the main branch anyime soon. > > Still I didn't find anything > > very useful in the posts that Google brought up. Can anyone > > recommend a way to work around OCaml's lack of operator overloading > > when dealing with matrices, vectors, and spinors? Is there a > > way to implement this with ocamlp4? > > Do you really want overloading for this purpose? If it's just for > cosmetic purposes, like being able to write > > z := A * x + y > > where x y z are vectors and A a matrix, then I for one am happy with > > z |:=| A %*| x |+| y > > (where %*| means matrix-times-vector, etc.). I guess there really is no accounting for taste! ;-) > At least you get to see what's really going on. The whole point of abstraction is to forget about what's really going on. Anyways, there are a number of places, besides linear algebra, where some kind of overloading is (arguably of course) desirable. In the FP world, you'll have to go to Haskell or Clean if this kind of thing is what you desire. Personally, I do desire it, but I think strict languages are better than lazy ones, and that that is a more important criteria than overloading. Certainly, C++ is not what I'm thinking about when I'm thinking nice thoughts about overloading. Implicit coercion and overloading shouldn't be mixed. > To my mind a more important limitation of ocaml is that it can't > do inlining across module boundaries, which means that the > possibilities for coding generic (as opposed to overloaded!) > algorithms using the functor/module system are often made less > attractive by slowness. It's the inlining, not the overloading, > which makes C++ templates useful for this purpose. Yes, this is a real problem too. The implementors will be employed for a long time to come! -- Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners