On Wednesday, 8 April 2015 at 17:17:21 UTC, Walter Bright wrote:
writeln is an OutputRange.

No, it isn't. It isn't even remotely close to one - an OutputRange is a type, writeln is a function. isOutputRange doesn't even return false for it, it outright fails to compile!

File isn't an output range either btw. An output range is defined by the presence of a put method, which File doesn't have.

b.d(4): Error: static assert (isOutputRange!(File, char)) is false


Even putting aside the formal definition of output range, output is NOT part of the pipeline! Pipelines can be composed and they keep pumping data through them. writeln does not transform its input nor does it forward it to the next item in the pipe. It just eats it.

That's totally different than everything else in the sequence. And that's not even bringing in writeln's sister function, writefln, whose first argument isn't what is to be printed at all! (it can show something to print but passing arbitrary strings to writef as the first argument is a major program bug, you should never do it)

Reply via email to