This is really confusing. In the REPL one can evaluate a stream to get 
useful info on what the object is:

julia> f
IOStream(<file test.txt>)

But in a script, just "f" would not work, so for debugging I try to print 
it to stdout:

julia> print(f)
[empty]

julia> println(f)
ERROR: attempt to write to a read-only IOStream
 in write at iostream.jl:208
 in println at string.jl:5

julia> print(repr(f))
IOStream(<file test.txt>)

I thought that "write" was the method to write to a file. 
Why is there this strange re-use of "println"? I suggest a "writeln" if it 
is just to append a newline to a file.
Why does "print" not use the representation of the object? 
Am I supposed to use "repr" every time, or am I just debugging the wrong 
way?

Reply via email to