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 (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.