https://dlang.org/phobos/std_stdio.html#.File.readln does not define what the function returns in case of EOF. Only the code example
// Reads `stdin` and writes it to `stdout`.
import std.stdio;
void main()
{
string line;
while ((line = stdin.readln()) !is null)
write(line);
}
suggests that a special string is returned which "is" null in that case.
Some design have been discussed back and forth [1]. But it seems that
the actual sentinel value is not null [2] but "" (the empty string).
Can this be made explicit both in the section "Return value" and in the example?
[1] <http://forum.dlang.org/post/[email protected]>
Re: Empty VS null array?
[2] This null value is not defined anywhere where it should be:
<https://dlang.org/spec/arrays.html>
Comment #1 by robert.schadek — 2024-12-01T16:38:47Z