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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 729D9BC0B for ; Wed, 13 Dec 2006 15:42:08 +0100 (CET) Received: from oden.vtab.com (dns.vtab.com [62.20.90.195]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBDEg7St023319 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Dec 2006 15:42:08 +0100 Received: from oden.vtab.com (oden.vtab.com [127.0.0.1]) by oden.vtab.com (Postfix) with ESMTP id 7008926EECA; Wed, 13 Dec 2006 15:42:06 +0100 (CET) Received: from virtutech.se (alfredo.hq.vtech [10.0.0.52]) by oden.vtab.com (Postfix) with ESMTP id 31B2D26EE88; Wed, 13 Dec 2006 15:42:06 +0100 (CET) Received: (from mattias@localhost) by virtutech.se (8.11.6/8.11.6) id kBDEg6c01555; Wed, 13 Dec 2006 15:42:06 +0100 Date: Wed, 13 Dec 2006 15:42:06 +0100 Message-Id: <200612131442.kBDEg6c01555@virtutech.se> From: "=?iso-8859-1?q?Mattias_Engdeg=E5rd?=" To: jon@ffconsultancy.com Cc: caml-list@yquem.inria.fr In-reply-to: <200612131409.24433.jon@ffconsultancy.com> (message from Jon Harrop on Wed, 13 Dec 2006 14:09:24 +0000) Subject: Re: [Caml-list] How to refactor a large Ocaml program Content-Type: text/plain; charset=iso-8859-1 References: <457FF423.7000703@abc.se> <20061213130922.GA17914@pulp.rsise.anu.edu.au> <4580079B.1020101@trusted-logic.fr> <200612131409.24433.jon@ffconsultancy.com> X-Virus-Scanned: ClamAV using ClamSMTP X-j-chkmail-Score: MSGID : 4580113F.000 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 4580113F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; mattias:01 mattias:01 refactor:01 ocaml:01 ocaml:01 lexer:01 parser:01 compiler:01 parsing:01 rewriting:01 parsing:01 trivial:01 haskell:01 intimately:01 innocent:98 >I don't think it would be a huge effort to write refactoring tools for OCaml. >Indeed, I've propose this idea for F#. The hard part is writing the lexer and >parser, which is already found in the front end of the compiler (albeit >without parsing of comments). Then you're just rewriting an AST, which is a >piece of cake in ML. :-) Writing smooth refactoring tools isn't always that simple, as it's not just a question of parsing and emitting trees. It is very desirable to preserve existing layout as far as possible, including comments. This doesn't mean it's hard, just that it may not be as trivial as an innocent programmer might think from your comment. See the Refactoring Functional Programs project, especially its final report. It was done for Haskell but anyone aspiring to write an OCaml refactoring tool would do well to learn from it. Intimately related to refactoring tools are programming environments with knowledge of the language - for code completion, type information, source navigation and so on. Tuareg-mode is very nice, but limited.