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
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 (07:05)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement?
> P.S.
> 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.
> This could be done attempting to generalize the type of the function,
> once we now it is a type variable.
> I'll have a try.

Wouldn't that break Obj.magic ? I can't see a clear solution to this
problem, unless enabling arity specification into polymorphic variables :
'a.0 for example, but this would also break something like :

let f x = if x then failwith "error" else fun() -> x

I guess it's more like a syntax problem. For example having parenthesis for
function calls à la C would disable any ambiguity.