3 ms·
Printing to stdout is a fallible operation.
by estebank 3y ago
Printing to stdout is a fallible operation.
- userbinator 3y agoWhat do you do if it fails, print a message to stdout saying that it failed? ...and what if that fails?
- estebank 3y agoprintln can panic, which by default tries to print to stderr, which can succeed independently of the state of stdout, and the global panic handler can be overriden to write to a log file, pipe an event to a port or just abort. But specialising the panic handler to instead only abort for the specific case where the only reason for a panic would be println is gold plating of the highest order. Adding complexity to the compiler and language to code golf the hello world binary size because 260kb is too much bloat is time I'd rather spend doing things that help the 99.99999% of other cases.