Getting Started with D

So, here’s the deal… I’ve never really blogged before.  I’ve always kind of had a bit of an itch to, but I’m going to finally go through with it, and hopefully it sticks.  Any advice you might want to give is more than welcome! In the meantime, let’s get going…

I decided that I’m going to learn the D programming language.

Why D?  Because I’m weird.  I consider myself a mid-tier programmer at best, but I want to be better.  It’s a language that compiles to native code, allowing higher performance (sometimes) than VM-based languages, and also doesn’t have their runtime requirements.

Why not C++? Everyone I talk to about it asks this, or in some cases, sort of berates me with it.  And it’s not a great reason, but I don’t like C++.  I started it as my first “real” language almost 15 years ago, and since then, I’ve found things like C# and Java that I feel make me personally much more productive.  I have no aspirations to write AAA games or anything really requiring bare-metal performance, so usually those are solid.  But I do still want to know something native.

Anywho… getting underway, this first post is going to be written as I go about getting my very first Hello, World running in D.  At this point, I don’t have an IDE, a compiler, or anything other than an itchy trigger finger.  For context, I’m on Windows 10 and will stay there for the foreseeable future. I do want to write cross-platform code though, and I’ve heard D is solid at that.

Compiler-wise, I found DMD here (https://dlang.org/download.html#dmd) and it comes as a simple installer for Windows, which also contains Visual D, a plugin for the D language for Visual Studio (I have VS2017) and gets DMC as well (not sure yet why this matters, but it was recommended, so we’ll go with it. I’m also installing DUB from (http://code.dlang.org/download), which is the official D package manager (think NuGet for .NET stuff), which also comes as an installer for Windows.

Once we’re into VS, we can create a new Project, and under the “Other Languages” category, there’s a D project Wizard.  I’m making a console application, and only checking DMD as the compiler configuration. It’ll build the project for us, and we’re greeted now with a single source file, containing the simplest of code

module DApp1;

import std.stdio;

int main()
{
writeln(“Hello D World!\n”);
return 0;
}

All I did here was hit F5  to build and run, and as expected, a quick window that probably displayed our text, and then a return code of 0.  Awesome. 😀

Leave a Reply

Your email address will not be published. Required fields are marked *