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.4 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id A1494BB84 for ; Fri, 26 Dec 2008 12:15:12 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhYCAM5LVElRZ90wlGdsb2JhbACDHIoYhjgBAQEBCQsICREDqSZYhQAIii2FCgiBMg X-IronPort-AV: E=Sophos;i="4.36,284,1228086000"; d="scan'208";a="20814305" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Dec 2008 12:15:12 +0100 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20081226111511.KJAX4080.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Fri, 26 Dec 2008 11:15:11 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20081226111511.FGXX21638.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com>; Fri, 26 Dec 2008 11:15:11 +0000 Received: from Countertenor ([149.254.192.218]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id mBQBF56M003593 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 26 Dec 2008 11:15:08 GMT From: "David Allsopp" To: "'Jun Furuse'" , References: <5160b4200812250547l35a1536fuf687d9e277999bd0@mail.gmail.com> In-Reply-To: <5160b4200812250547l35a1536fuf687d9e277999bd0@mail.gmail.com> Subject: RE: [Caml-list] [ANN] OCamlSpotter: OCaml compiler extension for source browsing, version 1.0 Date: Fri, 26 Dec 2008 11:15:05 -0000 Organization: MetaStack Solutions Ltd. Message-ID: <00a201c9674b$362aea00$a280be00$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 thread-index: Aclml0pVxcNHrJBWSlC9RIgR9CAJAQAskckg Content-Language: en-gb X-Scanned-By: MIMEDefang 2.64 on 81.102.132.74 X-Cloudmark-Analysis: v=1.0 c=1 a=I3G-EzTJPzoA:10 a=Ulc1cIAnboQA:10 a=BH_VBNbqAAAA:8 a=ZOzjf2MOAAAA:8 a=CjxXgO3LAAAA:8 a=KefplilGhx_lKk5n0jwA:9 a=-l4TNi_qZyt7JN8LZlMA:7 a=khTSI0pGs8venHzcwIgZbtPsMPQA:4 a=XF7b4UCPwd8A:10 a=G2AsRb49nnwmWARIy9zzNStElGQ=:19 X-Spam: no; 0.00; ocaml:01 compiler:01 ocaml:01 ocamlc:01 compiler:01 cmi:01 ocamlfind:01 gerd:01 findlib:01 emits:01 furuse:01 python's:01 functor:01 ocamlc:01 ocamlopt:01 This sounds really cool - but is it really necessary to patch OCaml 3.11.0 to achieve it? The .annot files produced by OCaml 3.11 give external reference information already... e.g. [Test.ml] open List;; rev [];; # ocamlc -c -annot Test.ml [Test.annot] "Test.ml" 3 15 15 "Test.ml" 3 15 18 type( 'a list -> 'a list ) ident( ext_ref List.rev ) The second entry in the .annot file shows the full module path required for the call to rev - taking into account all open, include statements and giving the full path in terms of packed modules and so on. Surely all you need once armed with the .annot file is the command line which was used to compile the module so that you can translate the module paths into actual files .cm* files (and then look for corresponding .ml files) - the code for tools such as cmigrep (not to mention the compiler itself) should contain everything necessary for analysing .cm[ox], .cmi and .cm{x,}a files to turn a given module path into the actual file reference. Capturing the command line used to make the .annot file would seem to me to be a better job for ocamlfind - I would have thought that you're more likely to get Gerd to accept a patch for a simple hook interface in findlib than to get a patch which emits additional output files accepted by the OCaml team (however, it might be worth raising a feature request for the OCaml team to add an entry to .annot files which records the command line used in the .annot file itself as I can't imagine that's particularly hard or a maintenance problem)... Happy Boxing Day, everyone! David > -----Original Message----- > From: caml-list-bounces@yquem.inria.fr [mailto:caml-list- > bounces@yquem.inria.fr] On Behalf Of Jun Furuse > Sent: 25 December 2008 13:47 > To: caml-list@yquem.inria.fr > Subject: [Caml-list] [ANN] OCamlSpotter: OCaml compiler extension for > source browsing, version 1.0 > > Hi, OCaml programmers, > > Here is your free holiday gift, OCamlSpotter version 1.0, a small > patch for OCaml 3.11.0. > > OCamlSpotter : OCaml source browsing > ==================================== > > Camel spotter: Oh, it was extremely interesting, very, very - > quite... it was dull; dull, dull, dull, oh God it was dull. > Sitting in the Waterloo waiting room. ... > > from You're No Fun Anymore, > Monty Python's Flying Circus > > OCaml module language is powerful. So extremely powerful that you can > be lost yourself easily inside a huge OCaml project with tons of > modules. > Spotting the definition of a variable is sometimes "extremely > interesting". > Let's see such an "exciting" example: > > include M > open N > open O > let _ = f 1 > > Suppose you are not familiar with the function f and want to spot its > definition. Where to find it? Just from the code you are looking at, > it is not sure: if you are enough lucky it may be f in m.ml, n.ml or > o.ml. Otherwise, it may be O.f in n.ml. Or probably N.O.f in > m.ml. If you are unlucky and the project is so sophisticated, there > could > be complex module operations in m.ml (i.e includes, functor > applications) > and therefore the definition might be found somewhere completely > unexpected. > Module packing, module load paths and library installation without .ml > files > complicate the situation even worse. > > You first days after joining a large OCaml project should be this kind > of manual value definition spotting with find + grep commands. Yes, > actually > it is very educational: you can learn a lot about the project > struggling > in the source tree (only if your collegues have organized things very > well :-P), but it is still a dull job... > > To say short, OCamlSpotter is a tool which does this dull job > automatically > for you and permits your energy for something more "interesting" like > Yeti > spotting: > > - The -annot option of ocamlc and ocamlopt is extended and creates > .spot files (.spit for .mli), which record the > location > information of the names defined and used in the module. > > - A small application ocamlspot provides automatic where-about > spotting > of the definition of the name you are interested in. > > - ocamlspot.el provides interactive ocaml-spotting of definition > locations in emacs. > > - Interfaces for other editors such as vi can be built easily, if you > want. > > Donwload > ======= > http://www.furuse.info/jun/hacks/ocamlspotter/ocamlspotter- > 1.0.tgz?attredirects=0 > > Have fun, and have a good new year. > > Jun FURUSE > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs