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
Warnings in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-02-19 (18:18)
From: Jacques GARRIGUE <garrigue@k...>
Subject: Warnings in ocaml
I have a few comments about new warnings in ocaml.

* having a warning when a function doesn't return unit in a sequence
may catch some bugs, but this is a pain with imperative programming
style, where you may not be interested by the result of a function but
just by its side-effects. Of course you can switch off the warning,
but I'm not sure having it on is a good default, since the default
mode should be normative.

ex. wrong code
	x = 3; ...
	  ^ should be <-

ex. right code
	f x y; ...
where f: t1 -> t2 -> int has some interesting side-effect.

* another common error with imperative code is partial application in
a toplevel call inside a module

let _ =
  somefunc hsj hjfhfd

somefunc takes 3 arguments but is only given 2. Since this is a
let-definition no warning is printed while such a partial application
is pretty meaningless.


Jacques Garrigue      Kyoto University     garrigue at
		<A HREF=>JG</A>