On Sunday, 15 January 2017 at 19:43:22 UTC, Nestor wrote:
I was reading some of the examples of writing a quine with D, but apparently the language has evolved and they no longer compiled unchanged.

So I tried to program one by myself using strings and std.stdio, but the result seems long and redundant:

import std.stdio;void main(){string s=`import std.stdio;void main(){string s=writefln("%s\x60%s\x60;s",s[0..38],s,s[38..$]);}`;writefln("%s\x60%s\x60;%s",s[0..38],s,s[38..$]);}

Any ideas for a shorter version (preferably without using pointers)?

I remember on Rosetta to have seen this:

module quine;
import std.stdio;
void main(string[] args)
{
    write(import("quine.d"));
}

compiles with: dmd path/quine.d -Jpath

Reply via email to