Hi Sönke,
Recently I sneaked D into our team by using it as a scripting language instead of using Python/bash.
Although I've not actually coded in D very much, the scripting experience was smooth. Soon I found that writing standalone little scripts with only phobos to assist was not enough, I came to be needing scriptlike, bzip and other facilities. So I came to realize that what I really need is dub support for scripting. I'd really like to just 'import' those third party dependencies with my script, like this:
#!/usr/bin/dub
@dependencies(`{
"scriptlike" : ">=0.6.0",
"bzip2" : "~master"
}`)
import scriptlike;
void main()
{
// ... actual D scripting code
}
Then when invoked like ./my_script.d -c -i {args}
, dub will do some preprocessing and treat this single file just like a dub project with dub.json read from the header comments and the D file as src/app.d
My philosophy is that to compete with python and other scripting languanges, a directory tree with config files is too heavy. I'd like to go even further to support something like this:
#!/usr/bin/dub
@require("scriptlike", ">=0.6.0");
@requrre("bzip2"); // version is optional
// don't even need to write import and (even) void main(), dub will generate them
run("cat hello >> output.txt");
bzip2("output.txt");
with this ability and carelly written scripting libraries like scriptlike, writing scripts in D would really shine IMHO.
What do you think?