On Wednesday, July 16, 2014 11:17:32 PM UTC-4, Laszlo Hars wrote:
>
> > the STDERR behavior was intentional
> 1) It just does not seem to be logical: warning messages still get written
> to STDERR. Why? And what is the use of STDERR, in general? STDERR is in the
> documentation, without telling anything about it.
>
You are confusing two output channels:
1) A Julia program may have side effects, e.g. it may call println(...),
warn(....), etc. These are written to some stream, by default STDOUT for
print and STDERR for warn, and in general you should use STDOUT and STDERR
just like stdout and stderr in C (and they use the same file descriptors as
libc's stdout and stderr, internally, which is useful for Unix pipes etc.).
This is a property of the Julia language and standard library.
2) When you execute a code block in the REPL, the REPL also prints its
result value (if any), or any exception that was thrown. This is not a
part of the code or a part of the Julia language or standard library, it is
a behavior of the REPL, which is an interactive program that happens to be
bundled with Julia. There is no reason to use the same output channel
here as the ones used for side effects of Julia code, and in fact it is
sometimes useful to have it be a different channel (e.g. if redirect_stdout
has redirected Julia side effects, but you still want to run the REPL).
And the REPL can be easily replaced by a different interactive
environment, e.g. IJulia or Julia Studio, and these environments may do
different things with the results/exceptions produced by expressions that
are evaluated.
> 2) The REPL behavior ought to be documented
>
The low-level mechanisms by which the REPL communicates with the terminal
are not part of the Julia language or standard library.
or they are so complicated, that I cannot include them into my programs.
> println("RESULT: ", eval(parse(readline())))
> As we discussed it several times, this does not work with multi-line
> input. Sure, I can write my own REPL, but this is not the issue here. We
> should not have to do it, since there is one included in the Julia
> distribution. It just does not seem to have sufficient documentation.
We explained to you several times how to capture multi-line input. You can
either use parse_input_line like the REPL or (better) you can devise your
own communication protocol (like the one used between IJulia/IPython), that
communicates code blocks to be evaluated in an unambiguous way.