Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Frank A. Christoph" <christo@nextsolution.co.jp>
To: <caml-list@inria.fr>
Subject: Re: Warnings in ocaml
Date: Mon, 22 Feb 1999 18:55:50 +0900	[thread overview]
Message-ID: <007a01be5e49$8825ba30$6f50ebca@newton> (raw)

 Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp> wrote:
>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.

I copied from SML and defined a procedure "ignore":

  let ignore k =
    let _ = k in ()

so now I would write:

  ignore (f x y); ...

I agree that it can be a pain to be explicit about this sometimes, but "ignore" makes it fairly transparent.

BTW, this procedure is a good candidate for addition to the standard library.

--FC


             reply	other threads:[~1999-02-22 12:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-22  9:55 Frank A. Christoph [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
1999-02-22 17:25 Don Syme
1999-02-22 18:16 ` Pierre Weis
1999-02-22 14:56 Andrew Kay
1999-02-22 13:45 Andrew Kay
1999-02-19 12:30 Jacques GARRIGUE
1999-02-19 18:32 ` Pierre Weis
1999-02-20 10:45   ` Markus Mottl

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='007a01be5e49$8825ba30$6f50ebca@newton' \
    --to=christo@nextsolution.co.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