Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features
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