From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5419FBC0B for ; Thu, 14 Dec 2006 12:59:57 +0100 (CET) Received: from dorado.vub.ac.be (smtp.vub.ac.be [134.184.129.10]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBEBxuju004480 for ; Thu, 14 Dec 2006 12:59:57 +0100 Received: from exchange.etro.vub.ac.be (etro10.vub.ac.be [134.184.2.10]) by dorado.vub.ac.be (Postfix) with ESMTP id 2249222B for ; Thu, 14 Dec 2006 12:59:54 +0100 (CET) Received: from ssel.vub.ac.be ([10.0.4.37]) by exchange.etro.vub.ac.be with Microsoft SMTPSVC(6.0.3790.1830); Thu, 14 Dec 2006 12:59:54 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by ssel.vub.ac.be (Postfix) with ESMTP id E7CBB2468013 for ; Thu, 14 Dec 2006 12:59:53 +0100 (CET) X-Virus-Scanned: amavisd-new at ssel.vub.ac.be Received: from ssel.vub.ac.be ([127.0.0.1]) by localhost (ssel.vub.ac.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1qbRPlr+vSFZ for ; Thu, 14 Dec 2006 12:59:43 +0100 (CET) Received: from [10.0.4.145] (unknown [10.0.4.145]) by ssel.vub.ac.be (Postfix) with ESMTP id B47142468041 for ; Thu, 14 Dec 2006 12:59:43 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <458106BD.7060103@abc.se> References: <457FF423.7000703@abc.se> <45800CD5.8050401@janestcapital.com> <458106BD.7060103@abc.se> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <82A46954-1B75-4966-B6B3-F93A0DA21001@vub.ac.be> Content-Transfer-Encoding: 7bit From: Bruno De Fraine Subject: Re: [Caml-list] How to refactor a large Ocaml program Date: Thu, 14 Dec 2006 12:59:43 +0100 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.752.2) X-OriginalArrivalTime: 14 Dec 2006 11:59:54.0036 (UTC) FILETIME=[5DE75740:01C71F77] X-Miltered: at discorde with ID 45813CBC.005 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; refactor:01 ocaml:01 ocaml:01 ocamlc:01 ocamlc:01 defines:01 annotations:01 lowercase:01 syntax:01 annotations:01 foo:01 defines:01 foo:01 universiteit:01 vub:98 Hello, I think there are a number of factors that certainly make it easier to develop refactoring tools for Ocaml: - it is a static language - there is already source code available for working with Ocaml code, e.g. ocamlc > Ocaml already has the -dtypes. Why doesn't this file contain > information about where the functions and types are defined. Yes, it seems like a good idea for ocamlc to emit defines/uses annotations, at least for lowercase identifiers in the syntax tree. For example, if I show these annotations in-place as comments: let foo(* defines: _global01 *) = 12 ;; let bar(* defines: _global02 *) x(* defines: _local01 *) = foo(* uses: _global01 *) + x(* uses: _local01 *) ;; bar(* uses: _global02 *) foo(* uses: _global01 *) ;; let foo(* defines: _global03 *) = "foo" ;; (* etc. *) Your editor would be able to jump from definition to usage and vice versa with this information. Editing and recompiling is what we currently use to discover this information mechanically, but it seems better not to have to make destructive changes to source files. Bye, Bruno -- Bruno De Fraine Vrije Universiteit Brussel Faculty of Applied Sciences, INFO - SSEL Room 4K208, Pleinlaan 2, B-1050 Brussels tel: +32 (0)2 629 29 75 fax: +32 (0)2 629 28 70 e-mail: Bruno.De.Fraine@vub.ac.be