D Lang is the Best of Both Worlds?

With the speed of C++ and the eloquence of modern languages, you would think that D is the goto for development these days. Although C++ is my favorite, I like to pick on it as well as Java. Here are some “Hello World” examples from each of the mentioned languages.

// D
import std.stdio;

void main()
    writeln("Hello World without explicit compilations!");
// C++
#include <iostream>

using namespace std; 

int main() 
    cout << "Hello World" << endl; 
    return 0; 
// Java
public static void main(String args[]) 
    System.out.println("Hello World"); 

Perhaps a “Hello World” isn’t the best way to showcase a language preference, but I think even something as trivial as the simplest program is revealing about each of these languages. In the last example, Java’s verbosity is evident with a somewhat substantial main declaration as well as the print statement. C++ isn’t too bad, but the way the print statement is handled isn’t the cleanest. By contrast, D is super straightforward.

Have you tried coding with D? It’s easy to setup for Visual Studio and is a pleasure to work with (https://dlang.org/).


Published by glubdos

World of Warcraft Developer, musician, and streamer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: