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:52) |
From: | Christophe TROESTLER <Christophe.Troestler+ocaml@u...> |
Subject: | Re: Visitor in OCaml |
On Mon, 19 Jan 2009 17:41:35 +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 You may also be interested in the paper "Code reuse through polymorphic variants" by Jacques Garrigue: http://www.math.nagoya-u.ac.jp/~garrigue/papers/fose2000.html Regards, ChriS