Browse thread
[Caml-list] Frustrated Beginner
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques Garrigue <garrigue@k...> |
| Subject: | Re: [Caml-list] Frustrated Beginner |
From: Brian Hurt <bhurt@spnz.org>
> > Mmm, not really convinced. For me ;, is a shortcut for :
> >
> > let () = ... in
>
> Or more accurately
> let _ = ... in ...
Well, both wrong :-)
The error/warning behaviour differs.
Actually, there are 4 possibilities:
construct \ type unit 'a function other
let () = ... in ... OK OK(*) error error
let _ = ... in ... OK OK OK OK
ignore (...); ... OK OK warning OK
...; ... OK OK warning warning
(*) the result type is unified with unit.
So, you have plenty of choice on how to sequence your code.
Additionally there are compiler options to ignore warnings or turn
them into errors.
(Having been bitten several times, I actually suggest avoiding "let _"
as it discards the very useful partial application warning. But of
course your need it for side-effecting code returning a function.)
Jacques
-------------------
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