Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] baffled by semicolon
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Radu Grigore <radugrigore@g...>
Subject: Re: Baffeld by manual (Was: [Caml-list] baffled by semicolon)
On 30 Aug 2004 18:06:58 +1000, skaller <skaller@users.sourceforge.net> wrote:

> The single ; is (usually) left associative binary sequencing
> operator of type unit that takes two expressions of
> type unit as an argument:

Only the left argument should be unit (otherwise a warning is emitted
since the result is silently ignored). The result of "e1; e2" is
(except side effects) the same as the result of e2. So something like
this:

(); (); (); 1;;

is perfectly legal and safe. The expression:

1; 2;;

Gives a warning since the result of the first expression is ignored
implicitely. To silence the warning you write:

ignore (1); 2;;

i.e., you ignore it explicitely.

regards,
radu

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners