Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] C++ templates to OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: padiolea@i...
Subject: Re: [Caml-list] C++ templates to OCaml
> Hi,
>
> What's the best way to imitate C++ templates in OCaml?

Well, simply use polymorphic types and functions.

> I have some
> code that makes extensive use of templates that I want to rewrite in
> OCaml, and using record types and functions is getting messy, and a
> lot more convoluted than the C++ code.
>
> Are objects the way to go here? And if so, can someone give me a
> simple example of how this would work?

read the ocaml manual,  or code in list.ml for instance in the
ocaml standard library.

> Jonathan
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>