Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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"

or

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

etc.

Don't ask me to implement it, though.

-- Damien