News for hackers. Stuff that matters.
Re:Quines: self-replicating programs (2005) by m3kw9 on Monday May 25, 2020 @09:59PM (#23306755)
What would be a practical use of this?
Re:Quines: self-replicating programs (2005) by gliese1337 on Tuesday May 26, 2020 @01:09AM (#23307614)
The existence of quines is a nice proof that biology isn't magic. Consider an alternate history in which computer science develops before organic chemistry. Prior to the development of organic chemistry, some common beliefs about life were, for example, that living matter was fundamentally distinct from nonliving matter, and life could not arise from non-living components; and that obviously no mechanism could contain its own description, so the only way biological reproduction could work is if, say, sperm actually contained miniature complete organisms, which in turn contained even smaller complete organisms, in an infinite regress (see https://en.wikipedia.org/wiki/Preformationism).

If, however, you can construct a quine, those beliefs are no longer "obvious". If you can write a program that replicates itself, then you can build a machine that replicates itself--and living organisms might well be such machines.

Re:Quines: self-replicating programs (2005) by cousin_it on Tuesday May 26, 2020 @01:41AM (#23307782)
I'm not sure the analogy quite works. The DNA of children is physically copied from parents, there's no quine-like encoding of DNA contents inside the DNA itself. In other words, life is more like a cheating quine that's allowed to say "read my source code from disk and print it" :-)
Re:Quines: self-replicating programs (2005) by c22 on Tuesday May 26, 2020 @02:39AM (#23308111)
Sure, except in this case the "source code reader" is also built from the source in question. More analogous, perhaps, to a self-hosting compiler.
Re:Quines: self-replicating programs (2005) by gliese1337 on Tuesday May 26, 2020 @12:15PM (#23312980)
True, but the point is not to produce a direct analogy--merely an existence proof.
Re:Quines: self-replicating programs (2005) by xamuel on Monday May 25, 2020 @10:19PM (#23306865)
Not directly a quine per se, but suppose you want to write a computer program which writes computer programs. And you want all these programs (both the one writing them, and the ones written) to be 100% self-contained, no importing from a util file or anything like that. Then if a util function shall be used in the writing program as well as in the written programs, then it'll need to be "injected" into the written programs in a Quine-like way.

Here's an extreme example, a program which writes programs, each of which writes programs, each of which writes programs, ..., each program being fully self-contained: https://raw.githubusercontent.com/semitrivial/ions/master/sr...

(For the context behind that program, see: https://github.com/semitrivial/IONs)

Re:Quines: self-replicating programs (2005) by mkj on Tuesday May 26, 2020 @02:06AM (#23307909)
It makes it simple to fulfil copyleft obligations to distribute source. Also helps avoid losing source to old programs - a custom vending machine firmware I know embeds source.

It would be cool if someone made a cargo-quine rust crate that bundled and compressed everything for a --source argument, maybe with "cargo vendor" as an option. Probably not _that_ much extra program size.

Re:Quines: self-replicating programs (2005) by mrastro on Tuesday May 26, 2020 @02:03AM (#23307895)
There might be no practical uses for this but it exemplifies programming as some sort of self-referential Ouroboros-type art. I think it's cool.
Re:Quines: self-replicating programs (2005) by awake on Monday May 25, 2020 @10:10PM (#23306813)
A computer worm