Warnings in ocaml

From: Jacques GARRIGUE (garrigue@kurims.kyoto-u.ac.jp)
Date: Fri Feb 19 1999 - 13:30:15 MET

To: caml-list@inria.fr
Subject: Warnings in ocaml
Message-Id: <19990219213015B.garrigue@kurims.kyoto-u.ac.jp>
Date: Fri, 19 Feb 1999 21:30:15 +0900
From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>

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 kurims.kyoto-u.ac.jp
                <A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:20 MET