Talk:Quine

From Rosetta Code
Revision as of 21:16, 21 November 2007 by rosettacode>Dirkt

I did not read up as fully as I should have on this task. The program is to output its own source without accessing files. This makes the examples here incorrect. See the wiki for more clarification. --Mwn3d 20:32, 17 November 2007 (MST)

I don't think this task does illustrate the comparative features of different languages very well. As the Wikipedia article explains, one way to solve this task that will work in every language is put the program code into a string, together with some mechanism to replace it at a special location with a copy of itself. For languages which keep a more-or-less one-to-one representation of the code around at runtime (Lisp, Smalltalk, Forth, etc.), it just boils down to accessing this representation. Smaller solutions are in danger of becoming an exercise in obfuscation, or at least become unreadable very quickly. And the examples seen now which mostly access files are obviously missing the point.

So I'd propose to delete this task, and replace it with a task that shows how to access (and maybe manipulate) code at runtime for languages that support it. The general solution can be subsumed by task(s) that show how string manipulation works. Dirk Thierbach 18 November 2007

The name of the task is Quine. A Quine is not allowed to open its source file and to copy it to standard output. All implementations which do this should be removed. 194.48.84.1 05:56, 20 November 2007 (MST)

The task states (perhaps not clearly enough) that the program itself should do the printing, not any toplevel read-eval-print loop, or equivalent. Otherwise, all constants in languages that have such a toplevel would be quines. But that is completely missing the point of the original problem, which (as explained for example in the book Gödel, Escher, Bach) is about self-application, and quoting. -- Dirk Thierbach 21 November 2007

I clarified the task. Different scenarios have different requirements for output. The Lisp example satisfied the spirit of the task (produce a usable reproduction of one's own code), so the task itself needed to be adjusted. I won't take that approach in all cases; It's a matter of the spirit of the task. --Short Circuit 13:06, 21 November 2007 (MST)
I beg to differ - it's not the "scenarios" which have requirement for output, it's the spirit of the task itself which is not correctly presented if you allow constants (or empty programs) as solutions. I strongly recommend to read at least the Wikipedia article, or the book mentioned above (your library should have a copy). The philosopher Quine studied self-reference, as exemplified in the paradox "'Yields falsehood when preceded by its quotation' yields falsehood when preceded by its quotation."
And it's this idea that makes up a Quine - A piece of code, applied to itself, once quoted and once unquoted. (BTW, this then again is the same technique used to prove undecidability theorems.) And the extra requirement "should print it's output" is one way to enforce that the quoting has to be done by the program itself, not by some external read-eval-print loop.
The task is bad enough as it is (it doesn't really help in comparing programming languages), and it's not improved by allowing "fortunate" border cases which take away the main point. Ok, so what's the procedure to resolve differences in opinion? Dirkt 14:16, 21 November 2007 (MST)