Is there really another single letter programming language? Yes, its called D . The D programming language comes from Walter Bright and Digital Mars. Its been around for a while, but with the recent v1.0 release its probably a good time to take a look.
D is a systems programming language focused on taking the performance and power elements from C/C++ and combining them with the productivity of languages such as Ruby and Python. D compiles directly to native code and looks very much like C/C++. There is a good comparison of the language here.
If you want to get started, the first thing is to download the compiler. Then write a little sample code:
int main(char[][] args)
{
printf("hello world\n");
printf("args.length = %d\n", args.length);
for (int i = 0; i < args.length; i++)
printf("args[%d] = '%s'\n", i, cast(char *)args[i]);
return 0;
}
Looks very similar to C on first inspection, with a few twists. In addition D provides for a garbage collector, contract programming, resizeable arrays, built-in strings, an inline assembler, and much more.
The built in strings are particularly useful. D introduces a new binary operator '~' for concatenation.
const char[5] abc = "world";
char[] str = "hello" ~ abc;
With contract programming D gives you not only asserts, but also pre and post contracts to validate function behaviour:
in
{
...contract preconditions...
}
out(result)
{
...contract postconditions...
}
body
{
...code...
}
So contract programming, built-in strings, resizable arrays... these things are not terribly new. They can often be implemented with some discipled programming and perhaps some extra C++ modules. So does D bring something serious to the playing table? I vote yes. Just as C# and the .Net framework enable developers to code at a higher level and be more productive (in certain applications of course), D could provide similar benefits to the lower level systems programming area where C/C++ still dominate.
- Login to post comments
-


radoshi | Mon, 2007-03-26 08:48
(Yet Another Systems Programming Language)
I have very serious doubts about D. IMO systems programming has to go on a vector where multithreaded and multiprocessor (parallel) programming is built into the language. The primitives that we have right now are way too error prone and difficult to use.
D is solving problems in C and C++ that C# and Java have already solved. These languages will become the systems programming languages of the future to replace C (glorified assembler) and C++ (glorified assembler with macros - whee!). I only hope that we get a better language (and D ain't there yet) that brings in parallel primitives into the language itself (erlang?) or makes parallel programming a breeze (just about any true lazily evaluated functional programming language).
While you're on your language bent, I would highly recommend reading http://www.math.chalmers.se/~rjmh/Papers/whyfp.html.
My current PL of choice is python. Everything that is good in OO / Java / C# minus all the annoyances.
http://redefine.dyndns.org/~radoshi/blog
- Login to post comments
»