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 RAA26195; Sun, 26 Sep 2004 17:27:11 +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 RAA25343 for ; Sun, 26 Sep 2004 17:27:09 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8QFR7RU018236 for ; Sun, 26 Sep 2004 17:27:08 +0200 Received: from [192.168.1.200] (ppp202-133.lns1.syd3.internode.on.net [203.122.202.133]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i8QFR4OU028012; Mon, 27 Sep 2004 00:57:05 +0930 (CST) Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features From: skaller Reply-To: skaller@users.sourceforge.net To: sejourne_kevin Cc: Jon Harrop , caml-list In-Reply-To: <4156DB56.2020003@yahoo.fr> References: <20040925225246.48566.qmail@web53010.mail.yahoo.com> <200409260234.50929.jon@jdh30.plus.com> <7f8e92aa04092522313d47820d@mail.gmail.com> <200409261405.37558.jon@jdh30.plus.com> <1096209379.28613.64.camel@pelican.wigram> <4156DB56.2020003@yahoo.fr> Content-Type: text/plain Message-Id: <1096212423.28613.110.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 27 Sep 2004 01:27:04 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4156DFCB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 inference:01 lacking:01 functors:01 ocaml's:01 functors:01 verbose:01 instantiate:01 functor:01 functor:01 hashtable:01 9660:01 glebe:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 2004-09-27 at 01:08, sejourne_kevin wrote: > skaller wrote: > > Sure but Ocaml offers other advantages such as type inference > > lacking in C++ that make code more concise -- as well > > as nice scoping constructs, lexical scoping, higher > > order functions, variants, and garbage collection. > > [Did I miss something .. ? :] > Functors? Ocaml's modular functors are harder to use and more verbose the C++ templates, so I didn't include them. You have to instantiate them manually, and also declare interfaces etc. Of course for more complex constructions they're probably better (because they're more modular). OTOH Ocaml does have a second kind of type functor -- (polymorphic type constructors) which are *easier* to use than C++ templates. Eg: List is a module functor, and list is a one of the simpler type functors. (Also for hashtable, which provides a simple type functor and a modular functor parameterised on the key type (but the value type is still a type variable .. :) -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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