Browse thread
C++/C# inheritance is bad?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2009-01-19 (17:49) |
From: | Richard Jones <rich@a...> |
Subject: | Re: Visitor in OCaml [was Re: [Caml-list] C++/C# inheritance is bad?] |
On Mon, Jan 19, 2009 at 05:41:35PM +0100, blue storm wrote: > On 1/19/09, Yoann Padioleau <padator@wanadoo.fr> wrote: > > What we want is really give code like > > > > let my_analysis program = > > analyze_all_expressions program (fun expr -> > > match expr with > > | FunCall (e, es) -> do_something() > > | _ -> <find_a_way_to_recurse_for_all_the_other_cases> > > ) > > > > The problem is how to write analyze_all_expressions > > and find_a_way_to_recurse_for_all_the_other_cases. > > You should have a look at the Camlp4 "metaprogramming" facilities : > http://brion.inria.fr/gallium/index.php/Camlp4MapGenerator Exactly what I was going to say. For an example where this camlp4 facility is used, see ocaml-gettext. Rich. -- Richard Jones Red Hat