Hacker News new | ask | show | jobs
by nojs 1561 days ago
I think they are arguing that it didn’t fail, it did everything you asked of it (it didn’t claim to successfully print hello world in every scenario, just to attempt to write to the buffer you gave it, which it did).
4 comments

It seems possible they are arguing:

    _exit(write(1,"Hello World!\n",13));
is the correct one, but to me that just kicks the can. What should happen here?

    os.rename(x,y)
    print("success!")
should this exit nonzero? The file did get renamed and progress was made, even if some unrelated problem occurs, so some animation for a users benefit who is probably dealing with some other problems thinking piping to /dev/full was a good idea in the first place, well, it just seems almost cruel to further burden them with a surprising error code, so maybe I should wrap that print line in a pokemon since the output doesn't really matter that much anyway.

So it is I prefer to think of bugs as the difference between expectation and reality, and I think it should be fair to say different users can be predisposed to have different expectations; So I also I think it matters a great deal what the contract/expectations are.

But I also know the difference between /dev/full and /dev/null

I think

   return printf("Hello, world!\n") < 0;
would suffice.

Edit : bugs are easy

Well, if you want your hello world program to try to write Hello world, then report success regardless of the result, then it is bug-free. If you intend your program to write hello world on your screen/stdout, then it is definitely buggy.

The computer will do what you ask it to do, it's only a bug, when it doesn't meet your expectations.

The program failed to check the return value of the called function.
No, I think the argument was pretty clearly that "the program failed but it can't possibly be expected to work under every conceivable scenario".