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/).

Beautiful!
Create your website at WordPress.com
Get started