On Wed, 26 Jan 2011 16:13:41 -0500, Trass3r <[email protected]> wrote:

(readln only uses ~= on buf, it doesn't change the original string)

What? Why does it take a ref argument then? If it doesn't overwrite the buffer passed in, there is no point in giving it a buffer.

No I meant it doesn't alter buf's original content, i.e. "hello"
Of course it modifies the array itself via ~= and thus takes it as a ref.
Though it should use 'out' instead I think.

Then why not return the newly-created buffer? Why alter the buffer via a parameter? It makes no sense to me.

Better API:

char[] readln();

or if you want different char types:

C[] readln(C = char)();

I think the original intent was for the code to overwrite the buffer, but it doesn't take into account the append improvements circa 2.041.

-Steve

Reply via email to