3 ms·
The issue is that most "hello world" programs are not correct.
by defen 4mo ago
The issue is that most "hello world" programs are not correct.
- dwattttt 4mo agoWhile most hello worlds do not check that the message was printed (which I assume writeStreamingAll does for you), dismissing the rest of the differences as "the others aren't correct" isn't really accurate. Explicitly passing IO in is a fine design choice, but it's not a correctness issue to say others are wrong to not do so.
- tester756 4mo ago>While most hello worlds do not check that the message was printed Should they?
- deleted 4mo ago[deleted]
- phire 4mo agoReally depends on what a hello world is meant to be a simplification of. If hello world is meant to be a simplification of printing large amounts of text to a buffered standard out? Then yes, it probably should be checking errors. If hello world is meant to be a simplification of low-volume debug logging to prove that code was reached (aka, printf debugging), then the simple alternative hello world using std.debug.print is what you want. For such debug prints, you don't want any buffering, you don't want it mixed in with stdout (despite the name, stderr is not just for error messages), and you don't really need to check for errors. And std.debug.print does not return errors.
- dlcarrier 4mo agoAlso, it's easy to make a C program return the number of characters printed and doesn't hurt readability: #include <stdio.h> int main(void) { return printf("hello, world\n"); }