caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian RINDERKNECHT <rinderkn@hugo.int-evry.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:00:45 +0200	[thread overview]
Message-ID: <20010912090045.A1262@hugo.int-evry.fr> (raw)
In-Reply-To: <00b901c13b53$4e3bc9b0$1e01a8c0@hama>; from SooHyoung Oh on Wed, Sep 12, 2001 at 03:22:32PM +0900

Hi Soo-Hyoung,

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

The sequence operator ; (semi-colon) is used for composing expressions
that may perform some side-effects. This is the typical construct of
imperative languages like Pascal. In Caml, such expressions are given
the type unit, and the only value of type unit is noted (). It
is generally considered as good practice to:

  (1) make sure that the expressions are of type unit, except maybe
      the last one, ie. given <e1>; <e2>; .... ; <en>; <e'>, then
      <e1>, <e2>, ..., <en> should have type unit;
  (2) use keywords "begin" and "end" to enclose your sequence:
      begin
        <e1>;
        <e2>;
        ...
        <en>;
        <e'>
      end

So, in your example, 1 is of type int, not unit (hence the warning).

For historical reason, this behaviour is not mandatory, and you can
turn off this warning in batch mode usign the -W s command-line
option. Please refer to
http://caml.inria.fr/ocaml/htmlman/manual021.html for other warnings.

As far as I am concerned, all warnings are turned into errors:)

Hope this helps,

-- 

Christian

-----------------------------------------------------------------------
Christian Rinderknecht                     Phone +82 42 866 6147
Network Architecture Laboratory            Fax   +82 42 866 6154
Information and Communications University  WWW   http://nalab.icu.ac.kr
58-4 Hwaam-dong, Yuseong-gu, Daejeon, 
305-752, Korea
-------------------
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


  reply	other threads:[~2001-09-12  7:33 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 [this message]
2001-09-12  7:18 ` Sven
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=20010912090045.A1262@hugo.int-evry.fr \
    --to=rinderkn@hugo.int-evry.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).