3 ms·
What would be a practical use of this?
by m3kw9 6y ago
What would be a practical use of this?
- awake 6y agoA computer worm
- xamuel 6y agoNot 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/src/LevelOmega/standalone/w%5Ew.py https://raw.githubusercontent.com/semitrivial/ions/master/sr... (For the context behind that program, see: https://github.com/semitrivial/IONs https://github.com/semitrivial/IONs)
- gliese1337 6y agoThe 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 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.
- cousin_it 6y agoI'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" :-)
- c22 6y agoSure, except in this case the "source code reader" is also built from the source in question. More analogous, perhaps, to a self-hosting compiler.
- gliese1337 6y agoTrue, but the point is not to produce a direct analogy--merely an existence proof.
- mrastro 6y agoThere 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.
- mkj 6y agoIt 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.