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.