Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Let's Code in D

Name: Anonymous 2012-02-02 9:08

Hey /prog/, why aren't you writing D, God's gift to programmers? Let's get this ball rolling.

import std.stdio;

template factorial(int n)
{
    const factorial = n * factorial!(n-1);
}

template factorial(int n : 1)
{
    const factorial = 1;
}

void main(string[] argv)
{
   writeln(factorial!(10));
}

Name: Anonymous 2012-02-02 15:38

>>23
You're right, I didn't say that correctly. D is *designed* to be as ubiquitous as C++, meaning that anywhere you use C++, you can use D instead and have just as powerful (if not more so) tools at your disposal.

That's exactly what C++ has going for it. It's fast, and it can do anything. D is fast, it can do everything C++ can, and it grossly simplifies or cleans up some places in C++ where things can get really ugly. Nobody LIKES writing something like std::vector<std::shared_pointer<int*>> vec = std::vector<std::shared_pointer<int*>> (); (which in D, assuming shared_pointer and vector are classes, would be auto vec = Vector!(shared_pointer!(int*))).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List