Quine using strings?

Nestor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 16 01:33:23 PST 2017


On Monday, 16 January 2017 at 06:41:50 UTC, Basile B. wrote:
> 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

Very good! By the way, module name and arguments aren't needed, 
so:

import std.stdio;void main(){write(import("q.d"));}

compile with: "dmd q -J."

PS. Isn't this approach considered "cheating" in quines? ;)



More information about the Digitalmars-d-learn mailing list