caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven <luther@dpt-info.u-strasbg.fr>
To: SooHyoung Oh <shoh@duonix.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Why warning?
Date: Wed, 12 Sep 2001 09:18:22 +0200	[thread overview]
Message-ID: <20010912091822.C1894@dpt-info.u-strasbg.fr> (raw)
In-Reply-To: <00b901c13b53$4e3bc9b0$1e01a8c0@hama>; from shoh@duonix.com on Wed, Sep 12, 2001 at 03:22:32PM +0900

On Wed, Sep 12, 2001 at 03:22:32PM +0900, SooHyoung Oh wrote:
> 
> Why is this warning occurred?
> Where can I get infomation about this? (ex: 'nnn' page on manual, articles
> or books)
> 
> # 1; 2;;
> Warning: this expression should have type unit.
> - : int = 2

Because you are throwing away the 1 value, and mostly you don't want to do
this, and it is a symptom of a typo or other kind of bug in your program.
There trully is no real difference bewteen 1; 2 and simply 2, they are
the exact same values. The only reason you would want to do something like
that is if you use functions with side effect, in this case, you can either
switch off this warning (not recomended) or use the ignore : 'a -> unit
function :

# ignore (1); 2;;
- : int = 2

Which does exactly what you want, without the warning.

Friendly,

Sven Luther
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-09-12  7:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-12  6:22 SooHyoung Oh
2001-09-12  7:00 ` Christian RINDERKNECHT
2001-09-12  7:18 ` Sven [this message]
2001-09-12  7:22 ` Jean-Christophe Filliatre
2001-09-12  8:47 ` David Mentre
2001-09-13 16:39 ` 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=20010912091822.C1894@dpt-info.u-strasbg.fr \
    --to=luther@dpt-info.u-strasbg.fr \
    --cc=caml-list@inria.fr \
    --cc=shoh@duonix.com \
    /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;
as well as URLs for NNTP newsgroup(s).