|
On Fri, 26 May 2017 17:32:49 +0200
François Perrad <francois.perrad@gadz.org> wrote:
> printf("x = %d y = %d", 10, 20); -- C
> string.format("x = %d y = %d", 10, 20) -- Lua 5.0
> ("x = %d y = %d"):format(10, 20) -- Lua 5.1
> cout << "x = " << 10 << " y = " << 20; -- C++
> string.buffer():put'x = ':put(10):put' y = ':put(20) -- proposal
The C/Lua 5.0/Lua 5.1 way looks a lot more readable to me, compared to
the C++/proposal method.
The reason being, with the format string, in a glance I can see what
the output will look like. With the stream, I have to put all the pieces
together in my mind first.
--
Aaron B. <aaron@zadzmo.org>