English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net

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