It has been C/C++ for me for quite some time now, actually 12 years by now since I started using both day by day. A few days ago I stumbled over D.
This is a reminder to myself what to set up and prepare for a working, enjoyable D development experience.
As usual, the easiest solution for installing software on the Mac is of course not the app store but installing Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The D compiler
Getting the D compiler installed is actually very simple then:
brew install dmd
The D package manager
Contrary to your experience with C/C++, D actually comes with a package/project manager by default. Dub is its name.
brew install dub
… and development tools
Just like Go, D is a very helpful language and so it comes with tools to support development, namely
- DCD: the D Completion Daemon is an auto-complete program for the D programming language
- dfmt: Dfmt is a formatter for D source code
- dscanner: Swiss-army knife for D source code, basically a code analyzer for D.
To install all of these
brew install dcd dfmt dscanner
… and bonus points for Visual Studio
Since I have been using Visual Studio Code, I went off to figure out if there is an extension that would support D development and there is:
The D language extension basically gives you everything you might desire for getting started.
Features of the D language extension
- Syntax Colorization
- Autocompletion using DCD
- Formatting using dfmt
- Linting using Dscanner
- Code upgrade using dfix
- Profiling using D Profile Viewer
- Integration with Dub using VSCode commands and tasks