D is great for small utility programs

Look how little code is needed to read from stdin, and do something with eash line of the output, in the D programming language:
import std.stdio;
 
void main() {
  foreach(line; stdin.byLine()) {
    writeln("Got input line: ", line);
  }
}
Compile the above code with:
dmd dtest.d -of"dtest"
... and pipe some output to the newly created binary:
ls -l | ./dtest

This should make D a perfect language for creating small utility apps for parsing text, that you can pipe to!

More tutorials can be found here

Tags:

Comments

Shebang

Note that D also supports shebang.

#!/usr/bin/rdmd
import std.stdio;
void main() {
// code
}

$ chmod +x dtest.d
$ ./dtest.d
$ ls -l | ./dtest