digitalmars.D - [OT] Stupid programmer tricks (or "Fun with RDMD")
- "Nick Sabalausky" <a a.a> Aug 17 2010
- Ellery Newcomer <ellery-newcomer utulsa.edu> Aug 17 2010
- "Nick Sabalausky" <a a.a> Aug 17 2010
- "Nick Sabalausky" <a a.a> Aug 17 2010
- Jonathan M Davis <jmdavisprog gmail.com> Aug 17 2010
- "Nick Sabalausky" <a a.a> Aug 17 2010
$ cat hello.d
import std.stdio;
void main()
{
writeln("Hello world");
}
$ cat rdmdhello.d
import std.process;
void main()
{
system("rdmd hello.d");
}
$ cat rdmd.d
[rdmd's source here]
$ rdmd rdmd.d rdmd.d rdmdhello.d
Hello world
$ Wheee!
Wheee!: command not found
Aug 17 2010
What? No infinite loop? Your [lack of] stupidity disappoints me.
Aug 17 2010
"Ellery Newcomer" <ellery-newcomer utulsa.edu> wrote in message news:i4f8in$2a42$1 digitalmars.com...What? No infinite loop? Your [lack of] stupidity disappoints me.
Oops! Good catch! I'm so embarrased by my oversight. Here you go: $ cat rdmdFOREVER.d import std.process; void main() { system("rdmd rdmdhello.d"); system("rdmd rdmdFOREVER.d"); } $ rdmd rdmdFOREVER.d Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world [snipped]
Aug 17 2010
"Nick Sabalausky" <a a.a> wrote in message news:i4fair$2grk$1 digitalmars.com..."Ellery Newcomer" <ellery-newcomer utulsa.edu> wrote in message news:i4f8in$2a42$1 digitalmars.com...What? No infinite loop? Your [lack of] stupidity disappoints me.
Oops! Good catch! I'm so embarrased by my oversight. Here you go: $ cat rdmdFOREVER.d import std.process; void main() { system("rdmd rdmdhello.d"); system("rdmd rdmdFOREVER.d"); } $ rdmd rdmdFOREVER.d Hello world Hello world Hello world
And just for the hell of it: $ cat rdmdFOREVERish.d import std.file; import std.process; void main() { system("rdmd rdmdhello.d"); if(!exists("KILL-FOREVERish-NOW")) system("rdmd rdmdFOREVERish.d"); } But you don't expect to kill it MANUALLY, without even using rdmd once, do you? So here: $ cat killFOREVERish.d import std.conv; import std.file; import std.process; import std.stdio; void main(string[] args) { int theFinalCountdown = 5; // DOOT! DO DO DOOOO DOOT!! if(args.length > 1) { try theFinalCountdown = to!int(args[1]); catch(Throwable e){} } if(theFinalCountdown <= 0) { writeln("DIE, FOREVER! DEAD DEAD DEAD!!"); mkdir("KILL-FOREVERish-NOW"); } else { writeln(theFinalCountdown); --theFinalCountdown; system("rdmd killFOREVERish.d "~to!string(theFinalCountdown)); } }
Aug 17 2010
But why didn't you put the entire output in your e-mail? You didn't wimp out and kill your program, did you? - Jonathan M Davis
Aug 17 2010
"Jonathan M Davis" <jmdavisprog gmail.com> wrote in message news:mailman.347.1282094325.13841.digitalmars-d puremagic.com...But why didn't you put the entire output in your e-mail? You didn't wimp out and kill your program, did you?
I'll just have to make one that submits each result to the NG automatically! . . . . . . . (No, I'm not actually going to do that...)
Aug 17 2010









"Nick Sabalausky" <a a.a> 