Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> The author points out that for binary machine code, the only notion of a quine that makes sense is for the executed code to output its own binary.

That’s not really true, though. A quine is a program that outputs its own source code, not a program that outputs itself in binary form. I’d therefore argue though that a “proper” quine should in this case output not the actual ASCII bytes, but the hex code for the bytes. After all, that is how they were typed in—the source code, so to speak. We wouldn’t expect a C quine to output anything but the actual C source code that was typed in, so why is this any different?

The normal recursive flow for a quine is source code -> (interpreter | compiler) -> execution -> source code. A program that literally outputs an executable version of itself doesn’t really meet that definition. I’m not sure what it is, but I don’t think it’s accurate to call it a quine.



It depends on whether you consider the binary to be the Programm, the ELF file, the hexdump, the assrmbly code, etc. All of these are a kind of programming language.


Not that I disagree with you, but…

> A quine is a program that outputs its own source code, not a program that outputs itself in binary form. I’d therefore argue though that a “proper” quine should in this case output not the actual ASCII bytes, but the hex code for the bytes.

Punch cards could legitimately be called source code. Those weren’t in hex, but rather in binary (at least the ones I’m remembering).


I think a punch card program that output to the console (or whatever punch card systems used for output, a teletype?) instructions for creating a new set of punch cards containing itself would meet the definition of a quine. The source code is the program itself, the “compilation” is the process of punching new cards, the execution is feeding the cards into the machine, and the output is the source code again.

What is described in the original article is more like feeding a program into the machine that does nothing and declares the fact that the original deck is now in the output bin to be a quine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: