Version française
Home     About     Download     Resources     Contact us    
Browse thread
Toplevel usage of stdout and stderr
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Toplevel usage of stdout and stderr
From: Robert Roessler <roessler@rftp.com>

> I am close to finishing my LablGTK-based syntax-colored GUI for the 
> toplevel... and I have noticed [the Windows version of] the ocaml 
> toplevel seems to use both stdout and stderr for warnings and errors.
> 
> Chapter 9 of the Objective Caml manual clearly states "results are 
> printed on standard output, errors on standard error" and further that 
> the Windows ocaml.exe "works exactly as under Unix".

Sometimes even developers don't read the manual.
I was convinced that in interactive mode errors go to stdout.
I even remember some discussions about this.
In practice it seems that errors go to stdout, but warnings go to
stderr. Not surprising as prerr_warning takes no parameter and prints
(almost) directly to stderr.

Sorry for this confusing situation. On Unix this is not too bad, but
on windows the buffering can be a pain IIRC.

If you are calling ocaml as a subprocess, ocamlbrowser provides a way
to do it, and even to kill the subprocess. Look in shell.ml. This is
rather mixed with Tk parts. The point is that on windows Fileinput did
not work on pipes, so an alternative system is coded using threads.

Jacques Garrigue