Difference between revisions of "Getting Started"
m (→specific search engine) |
m (clean up grammar, spelling, and a gender-specific phrase) |
||
Line 6: | Line 6: | ||
== Choosing a compiler == | == Choosing a compiler == | ||
− | As you probably already know, D is a [http://en.wikipedia.org/wiki/Compiled_language compiled language], so you have to make your first choice | + | As you probably already know, D is a [http://en.wikipedia.org/wiki/Compiled_language compiled language], so you have to make your first choice: a compiler. There are [[Compilers|several compilers to choose from]]. |
− | |||
− | + | They differ in: | |
* Installation procedure | * Installation procedure | ||
* Ease of building from source | * Ease of building from source | ||
Line 17: | Line 16: | ||
* Popularity | * Popularity | ||
− | Whichever you will choose, you shouldn't have | + | Whichever you will choose, you shouldn't have problems changing it. Options might differ but most code should be compatible with all of them. (If you find problems, please file an issue.) |
== Running D code like a script == | == Running D code like a script == | ||
− | After you have your compiler installed | + | After you have your compiler installed you'll want to do some coding. |
− | For small projects ( | + | For small projects it's handy to compile and run in a single step. Most (if not all) compiler packages, contain a tool named rdmd/gdmd/ldmd or similar. For instructional purposes we'll call it rdmd. |
− | + | Just create your source file, e.g. main.d: | |
− | |||
− | Just | ||
<syntaxhighlight lang="D"> | <syntaxhighlight lang="D"> | ||
import std.stdio; | import std.stdio; | ||
Line 34: | Line 31: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | and | + | and run the command line |
<pre>rdmd main.d</pre> | <pre>rdmd main.d</pre> | ||
− | If you properly installed | + | If you properly installed the compiler you should see 'Hello, world without explicit compilations!' on the terminal. |
Isn't that simple? | Isn't that simple? | ||
For more information about this tool you might look at http://dlang.org/rdmd.html or your compiler documentation. | 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 | + | You can use exactly the same command for building programs that are made of separate modules. Just 'import' the other modules. |
− | When your programs get larger, | + | When your programs get larger, consider using a [[build systems|build system]]. |
== Choose your code editor == | == Choose your code editor == | ||
− | + | See [[IDEs]] and [[Editors|Text Editors]] to learn about D editing tools. | |
− | |||
− | == Using D language | + | == Using the D language for your domain == |
− | + | Do you want to develop a game, web application, desktop application, or use D to drive your robot? | |
− | You can find more specialized information | + | You can find more specialized information for different disciplines at [[Development_With_D|Development with D]]. |
== Troubleshooting == | == Troubleshooting == | ||
− | Every complex software system might fail in its task. The same rule applies to DMD toolchain and maybe your application | + | Every complex software system might fail in its task. The same rule applies to DMD toolchain and maybe your application. |
− | If you're | + | If you're having compilation/runtime problems and you have no idea why, don't worry. There are some tools that will help. |
− | If your program doesn't compile | + | If your program doesn't compile and the error messages aren't enough, see [[Code Troubleshooting]]. |
− | + | If your program compiled but doesn't do what you want, see [[Debuggers]]. | |
− | + | Beyond that, [[Main Page#Community|the D Community]] is very helpful. | |
− | And remember | + | And remember: If your problem has to do with the D toolchain or existing D projects, don't forget save some time for others by [http://d.puremagic.com/issues/ reporting it]! |
== Searching with search engines== | == Searching with search engines== | ||
− | === | + | ===General considerations=== |
− | Googling for "D" is useless in looking for D related web sites. But Googling for | + | Googling for "D" is useless in looking for D related web sites. But Googling for [[https://www.google.com/search?q=d%20programming&rct=j D programming]] or [[https://www.google.com/search?q=d%20language&rct=j D language]] works well. Using '''dlang''' in combination with a search helps D in the TIOBE[http://www.tiobe.com/index.php/content/paperinfo/tpci/programminglanguages_definition.html] index. |
− | + | If you maintain 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 with your page rank and findability for those interested in D. | |
− | === | + | ===Specific search engine=== |
Let's say we want to search for the identifier '''indexOf''' using... | Let's say we want to search for the identifier '''indexOf''' using... | ||
− | * Bing or Google: add ''site:dlang.org'' to your | + | * Bing or Google: add ''site:dlang.org'' to your query. You'll get only the results which belong to the specified site: |
<code>indexOf site:dlang.org</code> | <code>indexOf site:dlang.org</code> | ||
− | + | Or add ''"dlang.org"'' to your query: | |
<code>indexOf "dlang.org"</code> | <code>indexOf "dlang.org"</code> | ||
− | * Yahoo search: add ''domain:dlang.org'' to your search string. You'll get | + | * Yahoo search: add ''domain:dlang.org'' to your search string. You'll get results from the specified domain: |
<code>indexOf domain:dlang.org</code> | <code>indexOf domain:dlang.org</code> |
Revision as of 07:57, 23 January 2015
So, when you have enough reasons to try D, let's get your hands dirty.
Contents
Your first program
For a beginner-friendly, step-by-step introduction on how to build your first D program see the hello world section of Ali Çehreli's online book Programming in D.
Choosing a compiler
As you probably already know, D is a compiled language, so you have to make your first choice: a compiler. There are several compilers to choose from.
They differ in:
- Installation procedure
- Ease of building from source
- License
- Performance
- Reliability
- Popularity
Whichever you will choose, you shouldn't have problems changing it. Options might differ but most code should be compatible with all of them. (If you find problems, please file an issue.)
Running D code like a script
After you have your compiler installed you'll want to do some coding.
For small projects it's handy to compile and run in a single step. Most (if not all) compiler packages, contain a tool named rdmd/gdmd/ldmd or similar. For instructional purposes we'll call it rdmd.
Just create your source file, e.g. main.d:
import std.stdio;
void main()
{
writeln("Hello, world without explicit compilations!");
}
and run the command line
rdmd main.d
If you properly installed the compiler you should see 'Hello, world without explicit compilations!' 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' the other modules.
When your programs get larger, consider using a build system.
Choose your code editor
See IDEs and Text Editors to learn about D editing tools.
Using the D language for your domain
Do you want to develop a game, web application, desktop application, or use D to drive your robot? You can find more specialized information for different disciplines at Development with D.
Troubleshooting
Every complex software system might fail in its task. The same rule applies to DMD toolchain and maybe your application.
If you're having compilation/runtime problems and you have no idea why, don't worry. There are some tools that will help.
If your program doesn't compile and the error messages aren't enough, see Code Troubleshooting.
If your program compiled but doesn't do what you want, see Debuggers.
Beyond that, the D Community is very helpful.
And remember: If your problem has to do with the D toolchain or existing D projects, don't forget save some time for others by reporting it!
Searching with search engines
General considerations
Googling for "D" is useless in looking for D related web sites. But Googling for [D programming] or [D language] works well. Using dlang in combination with a search helps D in the TIOBE[1] index.
If you maintain 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 with your page rank and findability for those interested in D.
Specific search engine
Let's say we want to search for the identifier indexOf using...
- Bing or Google: add site:dlang.org to your query. You'll get only the results which belong to the specified site:
indexOf site:dlang.org
Or add "dlang.org" to your query:
indexOf "dlang.org"
- Yahoo search: add domain:dlang.org to your search string. You'll get results from the specified domain:
indexOf domain:dlang.org