From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 3D9FEBB81 for ; Mon, 10 Oct 2005 17:04:49 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j9AF4mhd016858 for ; Mon, 10 Oct 2005 17:04:48 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA25062 for ; Mon, 10 Oct 2005 17:04:48 +0200 (MET DST) Received: from mail.physik.uni-muenchen.de (mail.physik.uni-muenchen.de [192.54.42.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9AF4l7g019244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 10 Oct 2005 17:04:47 +0200 Received: from localhost (unknown [127.0.0.1]) by mail.physik.uni-muenchen.de (Postfix) with ESMTP id 161412000A; Mon, 10 Oct 2005 17:04:47 +0200 (CEST) Received: from mail.physik.uni-muenchen.de ([127.0.0.1]) by localhost (mail.physik.uni-muenchen.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15790-01-75; Mon, 10 Oct 2005 17:04:46 +0200 (CEST) Received: from mailhost.cip.physik.uni-muenchen.de (kaiser.cip.physik.uni-muenchen.de [141.84.136.1]) by mail.physik.uni-muenchen.de (Postfix) with ESMTP id EEFD820006; Mon, 10 Oct 2005 17:04:46 +0200 (CEST) Received: from eiger.cip.physik.uni-muenchen.de (eiger.cip.physik.uni-muenchen.de [141.84.136.54]) by mailhost.cip.physik.uni-muenchen.de (Postfix) with ESMTP id 253D426E87; Mon, 10 Oct 2005 17:04:46 +0200 (CEST) Received: by eiger.cip.physik.uni-muenchen.de (Postfix, from userid 3092) id 6BBA012F75; Mon, 10 Oct 2005 17:04:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by eiger.cip.physik.uni-muenchen.de (Postfix) with ESMTP id 6754D12F17; Mon, 10 Oct 2005 17:04:46 +0200 (CEST) Date: Mon, 10 Oct 2005 17:04:46 +0200 (CEST) From: Thomas Fischbacher To: yoann padioleau Cc: Christian Lindig , Caml List Subject: Re: [Caml-list] possible to define a type where = is forbidden ? In-Reply-To: <14893115.1128951765427.JavaMail.www@wwinf1521> Message-ID: References: <14893115.1128951765427.JavaMail.www@wwinf1521> X-BOFH: Daemons did it MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: amavisd-new at physik.uni-muenchen.de X-Miltered: at nez-perce with ID 434A8310.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 434A830F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 caml-list:01 pointer:01 hash:01 subtrees:01 2005,:98 favored:98 cip:98 cip:98 lambda:01 lambda:01 wrote:01 polymorphic:01 expression:01 define:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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)