Monthly Archives: July 2015

Installing D


The first step to using D is to install it. Head over to and choose the correct version for your operating system. I am using Ubuntu 64 bit, so I chose Ubuntu/Debian x86_64.

If you’re using Windows, the easiest way is to select exe from the Windows section. This will give you an installer that installs D in C:\D and which also adds it in the PATH. There’s also an option to install a plugin for Visual Studio, Visual D. If you’re using Visual Studio, VisualD will be helpful as it provides things like project creation, code completion, etc.

Verify installation

To verify that the installation was successful, we can run the compiler to see if it’s there. Open your favorite terminal and type the following command:

dmd ﹣﹣version

If you see something like:

DMD64 D Compiler v2.067.1
Copyright (c) 1999-2014 by Digital Mars written by Walter Bright

then good job, you have successfully installed D!

Enter D!

Enter D!

I started learning C++ when I was 17 (in 2007). Back then, I thought that learning C++ was the way to become a game programmer — my teenage-hood (is this even a word?) dream . Although I have learned that it can be accomplished with other languages as well, knowing C++ is still, in my opinion, an important skill for a Computer Scientist to posses.

Nowadays I can say that I am fairly proficient with the language. I have made some small 2D games using C++ and I’m also using C++ for a client-server game I’m currently making — Shape Wars.However, compared to more modern languages, C++ seems a bit outdated.

One day I discovered a “new” and interesting language, called D. After browsing its official site, I decided that this is the language I want to program in, as an alternative to C++.

D is a language with C-like syntax and static typing. It pragmatically combines efficiency,control, and modeling power, with safety and programmer productivity.

So what is good about D?

  • No header files! Modules to the rescue
  • Compiles blazingly fast
  • Unicode aware string types
  • Functional style programming (or not if you don’t like it)
  • Garbage collector
  • A package manager
  • Is fast (± 10% the speed of C++)
  • Can interface with libraries written in C
  • Limited interfacing with C++
  • Compiles to native code or…
  • …can be used as a scripting language
  • Many, many more…

Like everything, there are also downsites:

  • Garbage collector. D’s GC is nowhere near as good as .NET’s or JVM’s
  • The language/runtime changes regularly and code breaks (the situation is better than the past though)
  • There are not a lot of libraries

If you have noticed, I have included garbage collector as both an advantage and a disadvantage. For some applications a GC is not a problem, while for others (real-time applications, e.g games) can be a disaster.

Thankfully, an annotation (@nogc) has been recently added which you can use to make sure your program does not allocate memory using the GC. However, many things in the language allocate using the GC – exceptions and strings come to mind, so it cannot be completely avoided for now. There is ongoing effort to make the GC completely optional.

So are you ready to learn something new? If yes, let’s dive into the world of D!
If not, thanks for reading anyway 🙂

If you don’t understand everything written above, there’s no need to worry. We’ll come to those subjects (and more) in the upcoming tutorials.

Facts about Richard Stallman

Here are some fun facts about Richard Stallman:
Generated with the fact command in octave.

  1. When Richard Stallman runs /bin/false, it returns “true”.
  2. If Richard Stallman has 1GB of RAM, and if you have 1GB of RAM, Richard Stallman has more RAM than you.
  3. Richard Stallman won a Sudoku that started with only one number in each line.
  4. Richard Stallman first words were actually syscalls.
  5. Whenever Richard Stallman looks at a Windows computer, it segfaults. Whenever Richard Stallman doesn’t look at a Windows computer, it segfaults.
  6. Richard Stallman once went out of scope for a while. The garbage collector never dared to touch him.
  7. Richard Stallman can solve the halting problem… in polynomial time.
  8. For Richard Stallman, polynomial time is O(1).
  9. When Richard Stallman gets angry he doesn’t swear; he recurses.
  10. Richard Stallman does not actually write programs. He comes up with a length and digit index in pi. More info
  11. Richard Stallman can fill up /dev/null.
  12. Richard Stallman’s DNA is in binary.
  13. Richard Stallman is so zealous about privacy he has /dev/null as his home.
  14. When Richard Stallman’s computer gets a virus, he simply applies a GPL license to it which converts the whole botnet to Linux. I mean, GNU/Linux.
  15. Richard Stallman’s doctor can retrieve a blood sample via CVS.
  16. Richard Stallman programmed Chuck Norris.
  17. Behind Richard Stallman’s beard there is another fist, to code faster.
  18. Richard Stallman’s first words were in binary. When they couldn’t understand him, he wrote a parser.
  19. Richard Stallman doesn’t evaluate expressions; expressions evaluate to Richard Stallman.
  20. Richard Stallman’s brain compiles and runs C code.
  21. Richard Stallman user GNU tar to compress air.
  22. Richard Stallman has a URL tatooed on the left side of his chest where you can download his genetic code.
  23. Richard Stallman never showers; he runs ‘make clean’.
  24. Richard Stallman gets 9 bits to the byte.
  25. Richard Stallman can release LLVM and clang under the GPL.
  26. When Richard Stallman counted his fingers as a kid, he always started with 0.
  27. Richard Stallman wasn’t born. He was compiled from source.
  28. Richard Stallman’s uptime is over 53 years. And counting up.
  29. Richard Stallman wrote a program to compute the last digit of pi.
  30. Richard Stallman can parse HTML with regular expressions.
  31. Richard Stallman wrote a program so powerful it knows the question to 42.
  32. Richard Stallman can touch this.
  33. Richard Stallman wrote a program that divides by zero.
  34. Richard Stallman was coded by himself in lisp with Emacs.
  35. Richard Stallman can telnet into Mordor.
  36. When Richard Stallman uses floats, there are no rounding errors.
  37. “They can take our lives, but they can never take our freedom.” — William Wallace after a little talk with Richard Stallman.
  38. Richard Stallman is the answer to the Turing Test.

Richard Stallman, upon reading these facts, didn’t laugh at all. Instead, he
complained that he is being linked to that dirty “open source” software. He
also asked it to be changed to “free software”, in order to raise awareness for
software freedom in our society.