Why Phobos is cool

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jul 16 22:44:59 UTC 2020


On Thu, Jul 16, 2020 at 06:41:42PM +0000, tastyminerals via Digitalmars-d wrote:
> On Thursday, 9 July 2020 at 16:26:09 UTC, H. S. Teoh wrote:
[...]
> > Here's another one: the most powerful one-line D program that ever
> > existed and will ever exist. It can do literally anything you tell
> > it do, and best of all, it doesn't even take up that much space.  In
> > fact, it takes literally no disk space at all.  All you have to do
> > is to run the following one-liner, and type in what you want it to
> > do as D code, and it will do it!  How amazing is that???
> > 
> > 	cat | dmd -run -
> > 
> > :-P
> > 
> > 
> > T
> 
> Without args cat reads from stdin and outputs to stdout which dmd -run
> - catches.
> However, I typed writeln("hello D"); after the one-liner above, hit
> enter and nothing happened. Hit enter again, nothing.

You have to end your input with ctrl-D.  DMD is not a REPL so it's not
going to evaluate individual input lines immediately.

But anyway, this particular one is a joke that refers to one of the
winning entries of the IOCCC from 1988 (see the entry by spinellis),
consisting of the single line:

	#include "/dev/tty"

It probably no longer works on modern C compilers, but the intent ought
to be obvious. :-)


T

-- 
We are in class, we are supposed to be learning, we have a teacher... Is it too much that I expect him to teach me??? -- RL


More information about the Digitalmars-d mailing list