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 KAA19499; Sat, 13 Apr 2002 10:52:50 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA19106 for ; Sat, 13 Apr 2002 10:52:49 +0200 (MET DST) Received: from smtpzilla1.xs4all.nl (smtpzilla1.xs4all.nl [194.109.127.137]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3D8qmr13275 for ; Sat, 13 Apr 2002 10:52:49 +0200 (MET DST) Received: from beertje.william.bogus (williamc.xs4all.nl [213.84.56.92]) by smtpzilla1.xs4all.nl (8.12.0/8.12.0) with ESMTP id g3D8qmH2049016; Sat, 13 Apr 2002 10:52:48 +0200 (CEST) Received: (from williamc@localhost) by beertje.william.bogus (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id g3D8mPY04325; Sat, 13 Apr 2002 10:48:25 +0200 X-Authentication-Warning: beertje.william.bogus: williamc set sender to williamc@paneris.org using -f From: William Chesters MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15543.61656.841585.602588@beertje.william.bogus> Date: Sat, 13 Apr 2002 10:48:24 +0200 (CEST) To: caml-list@inria.fr Subject: [Caml-list] operator overloading In-Reply-To: <5c4c7f87050f7f07d2@[192.168.1.6]> References: <5c4c7f87050f7f07d2@[192.168.1.6]> X-Mailer: VM 6.75 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Issac Trotts writes: > Looking at the Google results, operator overloading has come up > as a frequently discuseed topic. 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.). At least you get to see what's really going on. And in practice the cosmetics at this level are unimportant compared with all the other things you have to worry about. In my experience, few real algorithms can be coded using uniform, pretty, matrix algebra, especially if you care about speed. If yours can and you don't, then why not use matlab? ;) 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. ------------------- 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