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.2 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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 04F14BB84 for ; Mon, 22 Sep 2008 04:15:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgBAEac1kjRVYC/lGdsb2JhbACSYD4BAQEBCQkMBxEDmyWFVgECg3w X-IronPort-AV: E=Sophos;i="4.32,443,1217800800"; d="scan'208";a="15200987" Received: from fk-out-0910.google.com ([209.85.128.191]) by mail2-smtp-roc.national.inria.fr with ESMTP; 22 Sep 2008 04:15:08 +0200 Received: by fk-out-0910.google.com with SMTP id k31so1353754fkk.11 for ; Sun, 21 Sep 2008 19:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=GrQaP/eHcDyDzR5hbaGD0ZHfyTuV2Xvv1gz9PFm0ZVk=; b=Ix3vFIb9dpEsnm6lxs++XERiWdAIh47uSe7wJVOLDDT8xYAtsgmKq/wEf0MD/GRvke QNRpyu4HJpJ2zu+5bcLpmyzo1bMc4/GjclaVs08SGcpUegBEEPQN2N301fUZt3h5prrm 0MYAu16kyAAqxfWstniQX2zoEggLkk9zrllSM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=WgDypII6srkNF80p0uN0BOzZ+l9SUxL4Q6HETvfkhXnD4Wh583hg7eClyybOHv3+m8 lPwuD6tUeOBSW5baeLlTZdGACyfzC0A9slIAfu8zh3/JDBWx0Olic7ouCqal7YvtuKXc CX7DIl4K5KpoD5Ms4/9j/VX8hRRJ5mD1XKP3k= Received: by 10.180.236.14 with SMTP id j14mr1962587bkh.4.1222049707697; Sun, 21 Sep 2008 19:15:07 -0700 (PDT) Received: by 10.180.219.4 with HTTP; Sun, 21 Sep 2008 19:15:07 -0700 (PDT) Message-ID: <5160b4200809211915n6884f1f4ref75c273cb5020fd@mail.gmail.com> Date: Mon, 22 Sep 2008 11:15:07 +0900 From: "Jun Furuse" To: caml-list@yquem.inria.fr Subject: Re: Extending .annot files In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Spam: no; 0.00; furuse:01 furuse:01 compiler:01 compilation:01 functor:01 mli:01 compiler:01 camlp:01 compilation:01 marshaled:01 parsers:01 ocaml:01 ocaml:01 makefiles:01 gzipped:01 Hi, > I'm really happy to hear that you're open to including some of this > stuff. I think there are actually only a few data that one wants to > have in .annot files (and that the compiler can reasonably provide). > > For any identifier it would be good to know: > 1. Its inferred type > 2. Its fully-qualified module "path" > 3. Where it was defined, if it was defined in the current file. > > In addition, for each module referenced in the file it would be good > to know what file the module was read from. (This will allow some > hope of tracking down definitions in other files) In addition, ocamlspot records the following: - compilation load paths to find referred modules - abstractions of internally defined modules to find definitions of variables obtained from module aliases and functor applications - some hack for packed modules > It's hard for me to think of anything else that belongs in .annot > files. If I stretch a bit I suppose annotating variable definitions > with their range of scope might be cute. Maybe other people can think > of more original ideas. Many things: constructor/type/exception/module definition locations, corresponding .mli entry positions and so on. Some of them, especially type related things, require compiler side support definitely, but the others could be done by CamlP4 or something similar, I guess. I personally like to modify the compiler since all the interesting information is available at compilation for free and all we need is just to export it to some file, in an extensible format. Probably in a text file like the current annot, or as a marshaled value like ocamlspot does. Marshalled values are nice since we do not need to write parsers for them, and we can use lots of tool functions in the compiler to handle them. But of course, it is more difficult to keep backward compatibility, which Xavier is anxious about. > Finally, it may be worth putting a little work into reducing the size > of .annot files. One could certainly do much better with very little > effort. The size of the current annot files are more than 600% larger than the source ml files (I measured this by compiling ocaml compiler tree with -annot). Gzipping them makes them 1/10 (about 60% of the source size). However, the compiler should not rely on any external compression tool is available by default. You can easily add few rules to your OCaml project Makefiles to gzip annots automatically, and I guess it would be also easy to extend caml-types.el to support gzipped annot files. Still, it is possible to reduce the size of annotation files, by outputting as marshaled value, which makes things 35%, still more than twice larger than the source :-(. = j