From: Michael Furr <furr@cs.umd.edu>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] unused function detection
Date: Tue, 22 Jun 2004 15:46:48 -0400 (EDT) [thread overview]
Message-ID: <Pine.SOL.4.33.0406221531450.2202-100000@ramen.cs.umd.edu> (raw)
In-Reply-To: <1087932428.29427.33.camel@pelican.wigram>
On 23 Jun 2004, skaller wrote:
> On Wed, 2004-06-23 at 04:33, Michael Furr wrote:
>
> > I just finished(well almost) writing a tool which does something very
> > similar. The motivation was if I have some module M and a program P, what
> > is the most general(opaque) signature for M which still lets P compile.
> > This information can be extremely useful since you know exactly which
> > types are used opaquely and thus you can safely re-implement those data
> > structures. Also, if you have some internal function in a module and it
> > is not used anywhere in the program, it won't show up in the resulting
> > signature.
>
> ocaml -i + ocamldep. Shaken (not stirred)
Well, for handling types, its slightly more than that. For instance, if
I'm using some module with a definition:
type t = int * int
val f0 : int -> int -> t
val f1 : int -> t
val f2 : t -> t
and I have the program:
let x = f0 1 2 in
let y = f1 (fst x) in
let z = f2 x y in z
Then the inferred signature would be
type inferred1;
type inferred2;
type inferred3;
type t = inferred1 * inferred2
val f0 : int -> int -> t
val f1 : inferred1 -> t
val f2 : t -> inferred3
Thus you would know that 't' is only treated as a pair and never as a pair
of ints. Thus you could easily, say, swap out int for int32 without
affecting the rest of the program.
> Hmmm. At present, you are looking for uses of functions
[...]
> To solve my problem, you only need to add M to that list,
> looking for uses of M.f1 etc in M itself. [Of course I want
> the complement of the answer .. ]
Which shouldn't be too hard. The tool is just a (non-invasive) patch to
the compiler which I'll probably clean up and release in a few weeks once
I get a little more time. If you're interested in playing around with it,
let me know and I'll try to get to it sooner rather than later.
-mike
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2004-06-22 19:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-22 17:08 skaller
2004-06-22 17:31 ` David MENTRE
2004-06-22 17:59 ` Nicolas Cannasse
2004-06-22 18:32 ` skaller
2004-06-22 18:33 ` Michael Furr
2004-06-22 19:27 ` skaller
2004-06-22 19:46 ` Michael Furr [this message]
2004-06-22 18:38 ` Eric Dahlman
2004-06-22 19:18 ` skaller
[not found] <fa.edndqci.a2eggi@ifi.uio.no>
2011-02-08 10:52 ` Radu Grigore
2011-02-08 12:30 ` Gabriel Scherer
2011-02-09 0:02 ` Jerome Benoit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.SOL.4.33.0406221531450.2202-100000@ramen.cs.umd.edu \
--to=furr@cs.umd.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox