Browse thread
Re: [Caml-list] possible to define a type where = is forbidden ?
[
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: | -- (:) |
| From: | Thomas Fischbacher <Thomas.Fischbacher@P...> |
| Subject: | Re: [Caml-list] possible to define a type where = is forbidden ? |
On Mon, 10 Oct 2005, yoann padioleau wrote: > > http://caml.inria.fr/pub/ml-archives/caml-list/2003/09/ > > f81c8063ed4878e06f1ddd8010256050.en.html > > Interesting technique :) but I think that it would not solve my problem. > > To be more precise my program analysis tool try to compute "diff" between differents AST. > So we love to use pattern-patching and to (ab)use the polymorphic = to compare stuff. > > I don't see how your ExprAt technique will make this easier (not to mention that it also makes > the pattern matching ugly because I would have to wrap every expression with his ExprAt because I want > that the resultting Ast_diff contain also line number. When you want to associate extra data to stuff that should retain nice comparison properties, another technique which might be useful or not is to use a weak pointer hash, mapping subtrees to positions. I would not go so far as to say that this is the favored approach one should use, but sometimes this idea may be useful. At least, it's nice to have that trick available. -- regards, tf@cip.physik.uni-muenchen.de (o_ Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\ (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_ (if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)