3 ms·
If I'm writing a command line application then, most of the time, I just want to let the user know what's going on. It doesn't always have to be fancy and I don
by Phylter 8y ago
If I'm writing a command line application then, most of the time, I just want to let the user know what's going on. It doesn't always have to be fancy and I don't want to track down a third party library to tell the user all went well and give basic statistics. I'd go ballistic if I had to download a library to print out "35 records processed." It just doesn't make sense.
- AndyKelley 8y agoThen use std.debug.warn? Quoting the docs linked above: > Usually you don't want to write to stdout. You want to write to stderr. And you don't care if it fails. It's more like a warning message that you want to emit. For that you can use a simpler API: const warn = @import("std").debug.warn; pub fn main() void { warn("Hello, world!\n"); }
- tbodt 8y agoThe message "35 records processed" isn't a warning, nor should it necessarily go to stderr.
- xyproto 8y agoTools following the UNIX philosophy pride themselves on only bothering the user with output messages when something goes wrong.
- xyproto 8y agoYou can still write that message to strout, there just isn't a brief "print" function.