Browse thread
Why doesn't ocamlopt detect a missing ; after failwith statement?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Michal Moskal <michal.moskal@g...> |
| Subject: | Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement? |
On Fri, 26 Nov 2004 08:08:57 +0100, Nicolas Cannasse <warplayer@free.fr> wrote: > > 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 No, because here you're applying functional type that got unified with the variable, and not the ununified type variable itself. > I guess it's more like a syntax problem. For example having parenthesis for > function calls à la C would disable any ambiguity. And this is why an empty word as an function application is wrong :-) -- : Michal Moskal ::: http://nemerle.org/~malekith/ :: GCS !tv h e>+++ b++ : ::: Logic is a nice contrast to the Real World. :: UL++++$ C++ E--- a?