Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
To: caml-list@inria.fr
Subject: Warnings in ocaml
Date: Fri, 19 Feb 1999 21:30:15 +0900	[thread overview]
Message-ID: <19990219213015B.garrigue@kurims.kyoto-u.ac.jp> (raw)

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.

Regards,

	Jacques
---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>




             reply	other threads:[~1999-02-19 18:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-19 12:30 Jacques GARRIGUE [this message]
1999-02-19 18:32 ` Pierre Weis
1999-02-20 10:45   ` Markus Mottl
1999-02-22  9:55 Frank A. Christoph
1999-02-22 12:36 ` Xavier Leroy
1999-02-22 13:24   ` Anton Moscal
1999-02-22 15:06   ` Michael Hicks
1999-02-22 18:33 ` Ching-Tsun Chou
1999-02-22 13:45 Andrew Kay
1999-02-22 14:56 Andrew Kay
1999-02-22 17:25 Don Syme
1999-02-22 18:16 ` Pierre Weis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990219213015B.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox