Getting Started
So, when you have enough reasons to try D, let's get your hands dirty.
Contents
Choosing a compiler
As you probably already know, D is a compiled language, so you have to make your first choice - a compiler. In fact, you have from what to choose - there are couple of them.
Every compiler has its own strenght and weaknesses as they differ in:
- Installation procedure
- Ease of building from source
- License
- Performance
- Reliability
- Popularity
Whichever you will choose, you shouldn't have bigger problems with changing it. Options might differ, but most of code should be compatible with all of them (if you see any problem, just contact with maintainer).
Running D code like a script
After you got your compiler installed, you'll probably want to do some coding.
For small projects (and your first experiments with language won't be probably too big) it might be useful to merge compilation, and running your code into one phase.
Most (if not all) compiler packages, contain a tool that's named rdmd/gdmd/ldmd or similar. For instructional purposes we'll call it rdmd.
Just fill your file (i.e. main.d) with a sample application:
import std.stdio;
void main()
{
writeln("Hello, world without explicit compilations!");
}
and type in your commandline
rdmd main.d
If you properly installed your compiler, you should see 'Hello, world!' on the terminal. Isn't that simple?
For more information about this tool you might look at http://dlang.org/rdmd.html or your compiler documentation.
You can use exactly the same command for building programs that are made of separate modules, just 'import' in your source code properly. The only limiting factor is compilation time, which should be fast in D.
When your programs go larger, you might consider using a build system
Choose your code editor
Whether you're an IDE guy, or you like minimalistic text-editor approach, with D you have something to choose. Please, take a look on IDEs or Text Editors sections to learn something about it.
Using D language specific in your field
As you probably didn't come here out of nowhere, you have specific needs. Maybe you want to develop a game, web application, desktop application, or you want to use D to drive your robot. You can find more specialized information about different disciplines at Development with D section.
Troubleshooting
Every complex software system might fail in its task. The same rule applies to DMD toolchain and maybe your application. It's important to identify and resolve problems as fast as it's possible.
If you're in the unfortunate position of having some kind of compilation/runtime problems and you have no idea where is it come from, you don't have to worry, because there are some tools that will help you bear with that.
If your program doesn't compile, and error messages aren't enough, take a look at Code Troubleshooting that might save you some time.
On the other hand, if your program compiled, but fails from some unexpected reason, you can take a look on Debugging section.
If nothing helps, don't give up! D Community is very helpful and can ease your pain.
And remember, if your problem has something to do with D toolchain or any existing D project - don't forget save some time for others by reporting it!
Searching with search engines
Googling for "D" is useless in looking for D related web sites. But Googling for "D programming" or "D programming language" works rather well.
So, for everyone who maintains a web page on D, please refer to it at least once per page as "D programming language" rather than just "D". This should help significantly both with your page rank and general findability for those interested in D.