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=1.7 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE, SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id B4805BBAF for ; Wed, 19 Nov 2008 18:42:46 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvgCALveI0lQRFuwgWdsb2JhbACTVwEBFiK/YYJ5 X-IronPort-AV: E=Sophos;i="4.33,633,1220220000"; d="scan'208";a="20139943" Received: from furbychan.cocan.org ([80.68.91.176]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 19 Nov 2008 18:42:46 +0100 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1L2r4f-0002tP-9a; Wed, 19 Nov 2008 17:42:45 +0000 Date: Wed, 19 Nov 2008 17:42:45 +0000 To: Thomas Gazagnaire Cc: OCaml List Subject: Re: [Caml-list] annotate a .ml file with type information Message-ID: <20081119174245.GB10376@annexia.org> References: <9722eaea0811190632l66a36f2cge1cbf7fdee5d3044@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9722eaea0811190632l66a36f2cge1cbf7fdee5d3044@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; camlp:01 compiler:01 iirc:01 camlp:01 compiler:01 compilation:01 merging:01 wrote:01 caml-list:01 modules:02 ast:02 annotated:02 seems:03 seems:03 identifier:04 On Wed, Nov 19, 2008 at 02:32:09PM +0000, Thomas Gazagnaire wrote: > I would like to write a camlp4 extension which use infered-type information. > To do that, I can see two ways: > * either calling an type-inference function of the compiler, giving it an > AST and a context associating identifiers to types which seems to me a bit > complicated (and maybe impossible), IIRC this isn't possible from a camlp4 extension, partly because you can't call into the compiler like this, but mainly because at this stage in compilation you haven't even looked up which symbols come from which modules. You can't do that lookup because you don't have access to the command line (eg. the -I arguments), and anyway it'd be really hairy to try even if you did. > * or annotating the original source code with infered-type information - > which seems to me simpler. In this case, I believe that it is not difficult > to merge an ml file and its corresponding .annot file to produce a file > where every identifier is type annotated,[...] I'm sure that merging the .annot & .ml files together is going to be the easiest way. Rich. -- Richard Jones Red Hat