Checking the examples, my friction here is... why should I introduce a new language for those things?
First example program equivalence:
tr -s ' ' '\n' < file.txt
Second program equivalence: awk 'NR <= 10 {print} {total += $1} END {print "total:", total}' monies.txt
It takes to me more time, to understand what is doing D, even if theres is a previous explanation, that write down the equivalence with known tools.The last example needs to download/install dependencies, from the outside of the upstream software origins of my servers (that's a no-no in many places). apt-cache search vibe is no good for me.
If I could have need a program like that simple web example, nowadays I could go with golang, compile and deploy.
But the first two other solutions that come to my mind...
perl -Mojo -E 'a("/")->to_text(sub {
"Hello World " . shift->req->url->path
})->start' -l http://localhost:8080
Or something like... from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def hello_world():
path = request.path
return f'Hello World {path}'
if __name__ == '__main__':
app.run(host='localhost', port=8080)
I know that apt-get install libmojolicious-perl or install python3-flask is not an issue in many internal audits we did pass. Perl an Python are already present in the servers... or if puppet is in use, maybe ruby? ruby -rwebrick -e"WEBrick::HTTPServer.new(Port: 8000){ |req, res| res.content_type = 'text/plain'; res.body = 'Hello World ' + req.path; }.start"
But I know many places were adding new languages, using external package repositories for scripting languages, etc, is a problem...So, if it's for that article, I'm not 100% convinced to switch to D or invest my time in it... maybe I'm not the target audience.
I've nothing against D itself, but I need better marketing to be attracted.