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 RAA03867; Mon, 27 Sep 2004 17:19:32 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 RAA03817 for ; Mon, 27 Sep 2004 17:19:31 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8RFJTYn027211 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 27 Sep 2004 17:19:30 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.13.1/8.12.11) with ESMTP id i8RFJNHd002288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Sep 2004 10:19:26 -0500 (CDT) Date: Mon, 27 Sep 2004 10:30:01 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: skaller cc: caml-list Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features In-Reply-To: <1096297109.28613.646.camel@pelican.wigram> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 41582F81.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 hofs:01 foo:01 passing:01 superclass:01 templating:01 ocaml:01 heh:01 sep:01 sep:01 coding:03 04,:03 wrote:03 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 28 Sep 2004, skaller wrote: > On Tue, 2004-09-28 at 00:04, Brian Hurt wrote: > > On Mon, 27 Sep 2004, Jon Harrop wrote: > > > Second, you can do fold, map, iter, etc. in C++- it's just a pain. To > > emulate HOFs you define a new class with single virtual member function. > > The virtual member function then becomes your HOF. > > For templates all you need is a class with an operator()() method. > > Dynamic dispatch is only needed if you need > run time function variables (first class functions). All this means is that the calling code, instead of calling foo->doit(), now instead calls (*foo)(). Not that big of a difference in coding volume. And you still need dynamic dispatch because you're passing the superclass type in. Unless you're talking about templating the map/fold functions so that you get a different instantiation for each call? > > Heh .. it isn't a pain doing this in C++, its > quite easy -- just use Felix. > :-) I rest my case. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford 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