From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 35D847FBEB for ; Thu, 15 Jan 2015 19:16:12 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of aryx.padator@gmail.com) identity=pra; client-ip=209.85.192.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="aryx.padator@gmail.com"; x-sender="aryx.padator@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of aryx.padator@gmail.com designates 209.85.192.177 as permitted sender) identity=mailfrom; client-ip=209.85.192.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="aryx.padator@gmail.com"; x-sender="aryx.padator@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-pd0-f177.google.com) identity=helo; client-ip=209.85.192.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="aryx.padator@gmail.com"; x-sender="postmaster@mail-pd0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar4BAAkDuFTRVcCxlGdsb2JhbABagmR0WLNOAQaCdY1mgV8BCYVxAoEUQwEBAQEBEQEBAQEHCwsJEjCEDAEBAQMBEi4BGxILAQMBCwYFCw0NISECEQEFAQoSBhMSEId1AQMJCAEECLF7PjGNGYJ3imYKGScDChU/gyMBAQEBAQEBAQEBAQEBAQEBAQEBAQERAQUOhXeHSh2CCQQHgi1MHYETBYQ9BoUqgwOEWEuEBIFEgT+KYIQhNYEVhDFOAQGCQQEBAQ X-IPAS-Result: Ar4BAAkDuFTRVcCxlGdsb2JhbABagmR0WLNOAQaCdY1mgV8BCYVxAoEUQwEBAQEBEQEBAQEHCwsJEjCEDAEBAQMBEi4BGxILAQMBCwYFCw0NISECEQEFAQoSBhMSEId1AQMJCAEECLF7PjGNGYJ3imYKGScDChU/gyMBAQEBAQEBAQEBAQEBAQEBAQEBAQERAQUOhXeHSh2CCQQHgi1MHYETBYQ9BoUqgwOEWEuEBIFEgT+KYIQhNYEVhDFOAQGCQQEBAQ X-IronPort-AV: E=Sophos;i="5.09,404,1418079600"; d="scan'208,217";a="96570927" Received: from mail-pd0-f177.google.com ([209.85.192.177]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 15 Jan 2015 19:16:11 +0100 Received: by mail-pd0-f177.google.com with SMTP id ft15so17636085pdb.8 for ; Thu, 15 Jan 2015 10:16:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=x57uwIZKc8JLQK5w2sstKIcPw4IpaaVPKj7r6lvmtIA=; b=sjRnC7i3oywPPfJ1T8fONvlqarWaFs7UeLc0K7BQP5T74QlrlXlWonGHHUuDBrYqGP DO5ATs/lO0zNK4nObWpeLoyj6ZEEQVPB9pCnn5p5n/wFNV/Sic42BuYS3orva/Drl2Ww M0hX6qeZXkdCEieyocWfyae/kNqCTtoFviB7nWTAZwBT78mUXJQ0UP3Tqmyjfb6yOjSa v0f+heluH62oIXUFBoyPXxQBuzDXlFmGr9Dvd6XSUe9QkaS1xfgpMTFF/GtH14J3tl7u HH2y/FaQ93Fm9v3Im6iT43HZ0RXVqDXwwA3EBoHRCaWloOHlWwxkVQ+eRhwbY+m/fUyt za/w== X-Received: by 10.70.92.45 with SMTP id cj13mr6168065pdb.65.1421345769338; Thu, 15 Jan 2015 10:16:09 -0800 (PST) Received: from ?IPv6:2601:9:5780:18d2:fc41:c449:fd83:e354? ([2601:9:5780:18d2:fc41:c449:fd83:e354]) by mx.google.com with ESMTPSA id wy1sm2061396pbc.5.2015.01.15.10.16.07 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 10:16:08 -0800 (PST) Content-Type: multipart/alternative; boundary="Apple-Mail=_BDC71193-E81F-4C83-A1AC-8CD042C529CC" Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) From: yoann padioleau In-Reply-To: Date: Thu, 15 Jan 2015 10:16:05 -0800 Cc: Goswin von Brederlow , caml users Message-Id: <171D9BA6-40AA-4B44-BA06-24AE4A156715@gmail.com> References: <20150108133111.GA3745@pl-59055.rocqadm.inria.fr> <54AE8A9C.5090304@glondu.net> <20150108153342.GB4890@frosties> To: Ashish Agarwal X-Mailer: Apple Mail (2.1878.6) Subject: Re: [Caml-list] Detecting dead code, discovering a project's structure... --Apple-Mail=_BDC71193-E81F-4C83-A1AC-8CD042C529CC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Indeed the codegraph tool, part of Pfff, does some global analysis of an ocaml project using the .Mt (generated by ocamlc -bin= _annot) and generates an index of a codebase (a graph_code.marshall file). Not all features of Ocaml are supported though (e.g. functors). Once the graph_code.marshall file has been generated, you can use check, also part of pfff, to detect dead code or other errors. https://github.com/facebook/pfff/wiki/CodeGraph https://github.com/facebook/pfff/wiki/Scheck On Jan 8, 2015, at 7:50 AM, Ashish Agarwal wrote: > Maybe Pfff: > https://github.com/facebook/pfff >=20 > On Thu, Jan 8, 2015 at 10:33 AM, Goswin von Brederlow = wrote: > On Thu, Jan 08, 2015 at 02:48:12PM +0100, St=E9phane Glondu wrote: > > Le 08/01/2015 14:31, S=E9bastien Hinderer a =E9crit : > > > Are there tools / techniques one could use to make it easier to > > > discover / explore the source code of a big OCaml project? > > > > > > In particular, are there any tools available to help finding dead co= de > > > or coe that may need some refactoring? > > > > > > Many thanks for any suggestion. > > > > One suggestion: http://home.gna.org/oug/index.fr.html > > > > > > Cheers, >=20 > That looks cool. But that still needs a lot of manual filtering to get > results, e.g. to find an unused type or function specified in the > input signature for a functor. >=20 > It could be nice for ocaml to have warnings for this directly. E.g.: >=20 > module type M =3D ssig type t type s val x : int end > moduel F(M : M) =3D struct type t =3D M.t end >=20 > Warning: unused value x in signature M for functor F > Warning: unused type s in signature M for functor F >=20 > Similar for types / values defined but not used in .ml files that do > not appear in the .mli file. >=20 > MfG > Goswin >=20 > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20 --Apple-Mail=_BDC71193-E81F-4C83-A1AC-8CD042C529CC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 Indeed the codegraph too= l, part of Pfff, does some
global analysis of an ocaml project using th= e .Mt (generated by ocamlc -bin_annot) and generates
an index of = a codebase (a graph_code.marshall file).
Not all features of Ocam= l are supported though (e.g. functors).

Once the g= raph_code.marshall file has been generated,
you can use check, al= so part of pfff, to detect dead code
or other errors.
<= br>

https://github.co= m/facebook/pfff/wiki/Scheck


On Jan 8, = 2015, at 7:50 AM, Ashish Agarwal <agarwal1975@gmail.com> wrote:


O= n Thu, Jan 8, 2015 at 10:33 AM, Goswin von Brederlow <= goswin-v-b@web.de> wrote:
On T= hu, Jan 08, 2015 at 02:48:12PM +0100, St=E9phane Glondu wrote:
> Le 08/01/2015 14:31, S=E9bastien Hinderer a =E9crit :
> > Are there tools / techniques one could use to make it easier to > > discover / explore the source code of a big OCaml project?
> >
> > In particular,  are there any tools available to help findin= g dead code
> > or coe that may need some refactoring?
> >
> > Many thanks for any suggestion.
>
> One suggestion:
http://home.gna.org/oug/index.fr.html
>
>
> Cheers,

That looks cool. But that still needs a lot of manual filtering to g= et
results, e.g. to find an unused type or function specified in the
input signature for a functor.

It could be nice for ocaml to have warnings for this directly. E.g.:

module type M =3D ssig type t type s val x : int end
moduel F(M : M) =3D struct type t =3D M.t end

Warning: unused value x in signature M for functor F
Warning: unused type s in signature M for functor F

Similar for types / values defined but not used in .ml files that do
not appear in the .mli file.

MfG
        = Goswin

--
Caml-list mailing list.  Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


= --Apple-Mail=_BDC71193-E81F-4C83-A1AC-8CD042C529CC--