On Friday, 1 May 2015 at 07:15:58 UTC, Timo Sintonen wrote:
I repeat here that there are several output devices in a board
at the same time like serial port and lcd display. Printf can
not be bound to one device at compile time.
It is not hard to take the formatter out of printf and make it
a separate interface that can be connected to different
outputs. this way we do not need the libc dummies. I think this
is more the D and object oriented way. A hook sounds too much C
for me.
You can use std.format to get printf-style formatting and then
pass the string to where you want.
Even better would be a CTFE formatter. There was discussion
about this last year. Anybody knows the state?
There are quite a few people who want a CTFE formatter, I
believe, but that also has the issue of causing a lot of code
bloat. Remember also that you *can* use std.format.format at
compile time:
enum str = "This is a %s".format("test");