Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] unused function detection
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-22 (19:19)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] unused function detection
On Wed, 2004-06-23 at 04:38, Eric Dahlman wrote:
>  The name for this process was "tree shaking" if 

... camlshake .. is that a drink .. or a warning
to hide under the nearest park bench and quiver in fear?

> anyone is interested in looking into what was involved.

The problem is well understood -- it's just garbage collection
after all. The hard part is getting at the internals of the
Ocaml compiler, so as to avoid reinventing the wheel in
terms of parsing, lookup, etc but at the same time not
reporting generated garbage (compilers often generate
junk because it might be useful and optimise it away later).


Actually there is a modification of the original
problem which is slightly more interesting theoretically:
I personally often write:

let rec f x = ..
and g x = ...
and h x = ...

i.e. a huge chain of not necessarily mutually recursive
functions at the top level. It would be interesting
to see how one's scope control could be refined to make
the actual dependencies more evident. I also often

let f x = .. in
let g x = .. in 

when there is no dependency -- it just looks cleaner than

  f x = .. and
  g x = .. and

Obviously let[rec] [and] in can't express everything you want
in terms of scope control, so I doubt there is an 'ideal'
way to combine a set of functions .. which is what makes
the problem of re-writing them to better express the
dependencies interesting. [Of course there is a perfect
solution using modules]

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: