This is an overview of my experiments using the D programming language. To get more familiar with D, I remade a few of my programs using it.
From the D website:
D is a general-purpose programming language with static typing, systems-level access, and C-like syntax. With the D Programming Language, write fast, read fast, and run fast.
The language aims to be fast and reduce errors, both very important features! Reading the aims of the language, there are a lot of things to like about it.
The following are D versions of command line programs that are on this site. Source is included with each of them.
Based on the Pascal version, it takes an uncompressed/msvc1 AVI and converts it to a 2bit gray scale video that can be played on the Cybiko handheld computer using the StormPlayer video player.
Download now! (245k zip)
Takes an uncompressed 24bit AVI and converts it to a 8bit FLI/FLC file which is compatible with VLC. (All new!)
Download now! (226k zip)
Update: A newer version of this with source is in the test area
Download now! (220k zip)
The following is a Windows game created using D:
Over in the Test Area, is a Pac-Man type game made using D and the ARSD (simple display) modules created by Adam D. Ruppe. It features map loading via CSV and makes use of many other D features that the above utilities do not.
Go to the Test Area
These are things of note I came across while making the above. It is important to note that I am no expert in D and any problems I mention could be purely down to my lack of ability and understanding!
Small - I liked that it was a small download and install, especially compared to other languages like Rust and Go.
Great compiler! - DMD is a very fast and pretty helpful compiler! It flagged up many potential errors.
Appearance - The programs look a lot like their C versions. Converting from C to D would probably not be a difficult task for smaller programs and would take advantage of D's benefits.
Features - Lots of useful features such as easy to use dynamic arrays, a flexible foreach() that makes code much clearer, proper structs, and despite minor issues with rawWrite (see below) file handling is nice and easy too.
Structs - Having to create an array of one struct to write it to a file seemed odd and not intuitive.
rawWrite - If I had an array of 50 bytes, I could not easily write 10 of them to a file. This meant for avi2cvc I had to keep resizing the compressed data array which probably slowed things down.
Strings - Not used much in the above programs, but in others I found modifing them (such as replacing characters) a little tricky.
Larger exe's - The C version of avi2cvc is around 60k and the D version is about 10x that. I guess I am paying for the nice features and it would be less noticable for larger programs? The Pascal version was 96k.
No wildcard compiling - Minor quibble but I wish I could just do 'dmd *.d' like I can with FreeBasic, FreePascal, Java...
D is definitely worth a look at and I will probably be using it more when I can. The speed of the compiler is great and the built in checks really help reduce bugs. From using D, it seems to sit between C and Pascal in that it looks like C but features the strictness and some of the higher level features from Pascal.
Last Updated 11/02/2020