Julien SIGNOLES wrote:
> Hello,
> 
> Is it a bug or a well-known feature that the above program does not emit
> a warning (because "f x" should have type unit in the body of "g") ?
> 
> =====
> let f x = x
> let g x = f x; 1
> (* let _ = g 2 *)
> ====

The compiler could have a command-line switch that enforces the unit type in
sequences, i.e. it would add type annotations for you:

let f x = x
let g x = (f x : unit); 1

There's a camlp4/camlp5 syntax extension that does this (but I don't use it).


Martin

-- 
http://mjambon.com/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to