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
Why doesn't ocamlopt detect a missing ; after failwith statement?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-26 (17:01)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement?
On Nov 26, 2004, at 06:25, Jacques Garrigue wrote:

> I believe the problem with failwith is solvable, albeit rather
> complicated. The idea is that you want to be warned when you apply a
> function of type (\forall 'a. 'a) to something, because no such
> function may exist, so that this application will never actually take
> place.

More generally, you want to output a warning whenever the computation
of such a value is not immediately followed by a join in the control
flow graph, because at that point you know you're compiling dead code.

Then you would also get a warning for things like this:

   failwith "foo";
   print_string "hello world"


   f (a, b, failwith "foo", c, d)


Don't ask me to implement it, though.

-- Damien