This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Programming

New D language pumps up programmer productivity

By Nikolai Sivertsen on January 17, 2008 (9:00:00 AM)

Share    Print    Comments   

Is it possible to have the performance of C and C++ and the programmer productivity of modern programming languages such as Ruby and Python in a single language? That is the question Walter Bright, the author of the Zortech C++ compiler and the Digital Mars C/C++ compiler, asked himself when creating a successor to C++: Digital Mars D, a practical programming language first released exactly one year ago that helps you get the job done quickly.

Why create a new programming language? Because C++ is complicated and expensive to implement. Most C++ programmers get accustomed to using certain feature sets and never touch any others, because it is too hard to remember them all. This is not a problem for the compiler, but for other programmers trying to read the code it can be, because they might be used to other feature sets. D avoids this problem, because it was hugely simplified without removing important features. But that is not the only benefit D has.

One goal of D is to reduce software development costs by at least 10% by adding productivity-enhancing features and adjusting the language to eliminate time-consuming bugs. D supports imperative, structured, object-oriented, and generic programming paradigms. It should be relatively easy for C and C++ programmers to learn D, because it is very similar to C/C++. D is compatible with the local C application binary interface, which means that you can call C functions such as printf in D, but D is not compatible with C or C++ source code. D retains C++'s ability to do low-level coding, which is necessary for writing device drivers and operating systems. D has adopted a large number of helpful features from Java and C#, such as a garbage collector (although manual memory management is still possible).

A few months ago, when I began thinking about learning D, I thought it would take me a long time to learn, but I was wrong. Before learning D I did a little bit of Java programming, and found D to be similar. However, one problem about learning D today is a lack of good tutorials for people who have never programmed in C or C++.

There are two compilers for D: DMD and GDC. The former is the official compiler, and is 100% true to the standard of the D language and has a proprietary back end that converts the code to assembly code. The latter, GDC, uses the free front end of D and the back end of the GNU Compiler Collection (GCC). It is, unlike DMD, not yet 100% true to the standard, because the GDC developers have to catch up every time DMD gets new features. GDC runs on Linux, Mac OS X, Cygwin, FreeBSD, AIX, and MinGW. To make it compatible with other operating systems, the developers have to modify D's garbage collector to support those systems. This is not a lot of work and only has to be done once for each system, but so far it has been done only for the abovementioned operating systems.

On DSource, which is similar to SourceForge.net but only for D programs, you can already find several open source D projects, ranging from system libraries to GUI libraries to server programs and normal applications. For anyone wanting to help out with an open source D project, this is the place to look. The site also has a few tutorials and a forum for every D project on the site, where you can ask for help and talk to project leaders.

Several integrated development environments (IDE) support D, including Anjuta, Codeblocks, and Eclipse. You can find D plugins for text editors and IDEs on either DSource or Prowiki.

My favourite editor/IDE for D is leds, a "light editor for D." Leds is written in D, and its source code can be found on DSource. It features syntax highlighting, a syntax error checker, and build support from inside leds. I have not been able to build the latest version from source, because I always get core dumps and other errors, so I use the precompiled version, which sadly is quite old and does not have all the new features.

If you plan to write GUI programs in D, I advise you to use GtkD, a D language binding for GTK+. It works with Glade, a visual GUI designer for GTK+, which is a big bonus for me, as it makes GUI creation much easier and faster than writing the code by hand. Other GUI libraries, such as a port of the Java/Eclipse library SWT, a binding for wxWidgets, and some more, are available on DSource.

On the down side, due to the fact that D has been around for such a short time, there is a lack of tutorials and support.

Overall, D is a great new language. I hope it will become what it was intended to be -- a successor of C++. For anyone thinking about learning a new programming language, I would seriously recommend D, although it is advisable for people with no prior programming experience to start learning programming with another, easier language, such as Delphi or Java.

Nikolai Sivertsen is an avid Linux user who enjoys fiddling around with his OS.

Share    Print    Comments   

Comments

on New D language pumps up programmer productivity

Note: Comments are owned by the poster. We are not responsible for their content.

Wrong link to DSource

Posted by: Anonymous [ip: 213.208.70.235] on January 17, 2008 09:37 AM
The link to DSource in the article is wrong. It should be www.dsource.org

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 203.173.155.121] on January 17, 2008 10:23 AM
Calling it a 'new language' is a bit of a stretch... seems I've been hearing about it every now and then for must be 7 or 8 years...

#

Re: New D language pumps up programmer productivity

Posted by: Anonymous [ip: 192.33.238.6] on January 17, 2008 11:48 AM
Well, the wikipedia page talks about 1999... that means its 9 years old

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 71.181.77.202] on January 17, 2008 12:52 PM
Thanks for telling me what D is. Now tell me why I should use it.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 216.26.128.170] on January 17, 2008 03:46 PM
It may be 7-9 years old, but its first stable release (1.0) was just released in January of 2007.

That being said I see no obvious benefit to using D over C or C++. Just read D's FAQ: "Doesn't C++ have THIS feature in a library?" "Yes, but D includes it!"

So, why?

Oh, and the STL/strings part of the FAQ is amusing too. "Just the implementation of a string type in STL is over two thousand lines of code, using every advanced feature of templates. How much confidence can you have that this is all working correctly[...]?" Er, its the STL. I'm at least 98% confident in it. Why should we be confident in D's implementation of strings? Because D did it in less than 2k lines of code? That's not a good enough reason.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 87.194.179.238] on January 18, 2008 01:26 AM
^ You guys haven't read much about D, have you?
Btw, Andrei Alexandrescu (for those in the know) is involved in D 2.0 AND his book on D is due out later this year.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 75.63.128.229] on January 18, 2008 08:14 AM
great another new language to learn that will be obsolete in 2 years, in time to learn yet another new language Yippee!!

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 80.254.147.36] on January 18, 2008 08:32 AM
If you think that it will be obsolete in two years then don't bother learning it. Me, I'll stick with C/C++ until I find it an absolute necessity to learn D.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 24.16.50.251] on January 18, 2008 09:19 AM
The benefit to using D over C or C++ is the language enables you to do directly what requires a lot of extra work in C++.

#

Re: New D language pumps up programmer productivity

Posted by: Anonymous [ip: 125.59.81.236] on January 18, 2008 11:16 AM
For example....?

If the only different between D and C++ are builtin and STL, then I'd rather stick with C.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 89.176.188.209] on January 18, 2008 09:57 AM
This article is stupid. You didn't say anything important about D, instead you just compare it to C++. I think that D is a dead project (going to slow), beter use Eiffel, it compiles into C and has very very nice ideas behind it.

And, well we are all waiting for the new C++ standard anyway :)

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 24.16.50.251] on January 18, 2008 10:34 AM
You go right ahead and wait many more years for C++0x, then more years for C++0x compilers, while "slow" D already is way ahead of it and is available now.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 67.183.83.234] on January 18, 2008 11:06 AM
D > C++ because it has built-in GC, no real cruft left over from C, and especially because it has first-class support for metaprogramming. You can evaluate normal runtime functions at compile time (as long as they are pure functions), which makes it possible to do all sorts of compile-time optimizations that simply are beyond the scope of most imperative languages. D also has built-in support for unit tests (you write them in the same source as your code, if you want), contracts (a la Eiffel), and type inference (which is certainly not something you expect from a C- or Java-like language). Go ahead and wait for C++ to get type inference, if you're lucky. They've been talking about overloading 'auto' for years. You would not believe how much needless redundancy is eliminated by type inference (and it makes complex template expressions totally easy to work with...try to name the resulting type of a big MPL expression). Overall, D offers a bunch of stuff that neither C++ nor Java have or are likely to get in the near future.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 88.76.58.41] on January 18, 2008 11:14 AM
C++ will never be where D is, because that also requires *dropping* features, not just adding them. Something the ISO committee will not do (C++ carries around a lot of backward compatibility to the 70s after all). Besides that, C++0x apparently doesn't even take care of all the major shortcomings C++ has (like the lack of language modules, responsible for the ridiculously slow builds and namespace/header file chaos), because the standardization process is too slow (see recent video of Stroustroup talk). If you look at what D has done in that time, calling it slow is obviously nonsense.
Another plus for D is the fact that there is little to learn for C++ programmers. First and foremost D is very C++-like. It is the details where it differs. Details, that most C++ programmers are annoyed with in their language.

#

Sell it to IT

Posted by: Anonymous [ip: 208.242.58.126] on January 18, 2008 12:02 PM
when it comes down to it, it's not just a programmer's choice to decide to use D over C++ or C or Java. The projects that are significant are dictated by a corporate (or govt) committee. That committee will consist of all levels of staff, to include programmers, lead developers, architects, managers, and even Cxx types. ......................... So, how are you going to sell YANL, such as D, to that committee? Um, it's a fairly new language, sir, the 1.0 release occurred in Jan 2007 ... D 2.0 was released in July 2007, but has experimental features. Yes ma'am, it's not certified by ISO or other committee. Um, successful, large-scale projects? In the research I've done, I've not found any [successful] high-visibility projects. .................................. Yea, D might be cool to implement for that simple 4-6 week back-office project, but let's see you sell it for an, important, high-visibility corporate-wide or government organization project.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 89.163.120.144] on January 18, 2008 02:19 PM
> Um, successful, large-scale projects? In the research I've done, I've not found any [successful] high-visibility projects.
> Yea, D might be cool to implement for that simple 4-6 week back-office project, but let's see you sell it for an, important, high-visibility corporate-wide or government organization project.

That's the most annoying problem with a chicken and an egg.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 192.168.10.3] on January 18, 2008 06:12 PM
> responsible for the ridiculously slow builds (related to C++)
Yep, but this is mostly due language stuff (templates and MPL childish playgrounds) so compiler developers have to use academic research papers to make them work. Compile-time optimizations??? Come on !

> D > C++ because it has built-in GC
I'm just curious, why people see GC as salvation? No pun intended, but GC is designed for seasoned programmers. Probably someone will call me nuts, but those who ever encountered problems with leaks in Java GC will know what I'm talking about. Ordinary malloc()/free() leaks you can always fix, but GC leaks don't. And... there is _no_ perfect GC.

> we are all waiting for the new C++ standard anyway
I'm just hoping it will never come :P. Someone said: "That ship abandoned smart peoples long time ago". Fully agree :)

Now, where is that D... :)

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 74.85.3.97] on January 18, 2008 06:41 PM
"Why create a new programming language? Because C++ is complicated and expensive to implement. Most C++ programmers get accustomed to using certain feature sets and never touch any others, because it is too hard to remember them all. This is not a problem for the compiler, but for other programmers trying to read the code it can be, because they might be used to other feature sets. D avoids this problem, because it was hugely simplified without removing important features. But that is not the only benefit D has."

Let the above be a warning to all the people out there trying to add all kinds of language features to Java. If you keep doing that, eventually it will turn into C++.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 217.229.50.106] on January 18, 2008 07:10 PM
There are some other points to keep in mind: The DMD is not completely open source and there's no x64 port, so GDC is actually very important, but according to sourceforge it has only a single developer!
I'm not so sure if it wouldn't be better to simply create a frontend for C or C++ and reuse existing C compilers with all their optimizations - they take years to implement so why reinvent the wheel. The result is something like Mono which get beaten by factors by the MS .NET runtime. The GDC frontend of course has that advantage already though creating a gcc frontend isn't that easy either. I don't know whether the digital mars c compiler and DMD share the same backend).
An interesting language that uses that approach is Vala (http://live.gnome.org/Vala). Another language to keep track of!

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 88.76.58.41] on January 19, 2008 01:43 AM
> Ordinary malloc()/free() leaks you can always fix, but GC leaks don't.

in D you can do both. write programs that only use GC, only new/delete, some GC, some new/delete, GC supported pooling, new/delete based pooling - you name it. and all that is easily accessible and non-confusingly designed.


> Yea, D might be cool to implement for that simple 4-6 week back-office project, but let's see you sell it for an, important, high-visibility corporate-wide or government organization project.

there's a huge space between 4-6 week projects and that high-profile corporate/gov. projects you're talking about. and D is surely ready to do bigger things than 4-6 week projects, as can be seen by looking at existing D projects.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 213.42.173.66] on January 19, 2008 06:24 AM
I think the Language D will never match C++ and now that C++ is under revival (C++0x) - the new set of C++ standards with direct threading, garbage collection support, Language D is out of equation and by the way, the language is at least 9 years old.

The references for C++0x:

http://en.wikipedia.org/wiki/C%2B%2B0x
http://www.research.att.com/~bs/bs_faq.html#When-next-standard

Also, C++0x is not a new language, but it's just a new standard for C++ from the same genius. C++ ROCKS!!!!

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 222.212.178.81] on January 19, 2008 07:21 AM

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 62.148.150.64] on January 19, 2008 08:09 AM
I often recall what I read somewhere in the Net when Java was on the take off. It was like "people are not going to Java, they are running away from the Microsoft platform, and it looks like they are ready to run anywhere". I guess this equally applies to D. C++ stagnates for so long, that even C++ .NET is an option.

"Chicken and egg". I disagree. There is no such problem for a programming language. If it is created to solve something, the very first project is the poster child all suits are satisfied with, like C -> Unix. If it is cool, a community gathers around it and the poster child is born in less than 9 years, like Ruby -> Rails.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 90.193.93.142] on January 19, 2008 11:58 AM
C++ is the daddy... remember that.

All this experimentation in new programming languages results in lazy and dumb programmers that boast about their productivity while literally learning nothing.

It is the dumbing down factor and sense of greatness that Java and GC gives, it is the same for .NET.

Those guys are not compiler devs or engineers, they are plain old mass market developers.

And while it has its market, do not piss on what C++ keeps giving you 20 years later. Your generics cannot even compare, they suck at best.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 90.193.93.142] on January 19, 2008 12:02 PM
Ruby is screwed.. Haskell will not catc on. C++ takes its time because it is doing the right thing, engineering, not hacking another VM that will be written in it. Just like your Ruby is written in awful C, JVM and CLR are written in well, not so impressive, C++.

All those new languages are toys for enthusiasts, and the academia guys whilst very smart were, let's face it, never in touch with the commercial side.

It is that simple: C and C++ 'legacy' is not going away and it will keep evolving at a pace that is proven before some Sun vs MSFT vs Oracle vs Open-Source vs Ruby vs Google vs Scripters battle is over. The reason is again very simple: it is the C++ model that can, and *actually* does cover/implement them all.

And it is very easy to cfhange compiler options not to allow typeless programming or whatever you wish..

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 76.108.130.138] on January 21, 2008 08:53 AM
D is not a VM. The D compilers are serious native cpu compilers. The GC is not required to use it. You can go as low level as C with better embedded ASM support. The guy(s) who came up with D came up the C/C++ compiler that was THE basis of just about every commercial C/C++ ever made.

The Tango/Mango libraries are very very cool.

#

A book

Posted by: Anonymous [ip: 85.221.53.194] on January 22, 2008 10:51 AM
I would just like to note that an English book on D _has_ been published, Learn to Tango with D, and is currently available as an ebook from Apress or pre-orderable from Amazon. Read more about it at

http://www.dsource.org/projects/tango/wiki/LearnToTangoWithD

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 86.108.49.15] on January 22, 2008 05:29 PM
i think its the managed code phase. java and c# (.net) r the languages of the future, as a C/C++ programmer for years i kept avoiding even listening to talks about JAVA cuz i hated the whole idea of managed code. but i must say that i cant avoid C# and the .net any longer as they r slowly dominating everything even embeded systems ( what a joke i know but its the truth, im seeing it myself ). .NET and C# will rule and MONO is maybe the best thing that ever happened to open source. so to any beginner interested in learning a programming language, pls go the .NET way or the java way and save yourself alot of hassle.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 65.2.179.37] on January 26, 2008 08:58 AM
>> so to any beginner interested in learning a programming language, pls go the .NET way or the java way and save yourself alot of hassle.

Rah rah rah. Rah rah rah. Go.....oh managed code. Yeah.

[Putting pom-poms away...] I think you need to do a little more than cheering to sell the "managed code" you are selling. The key is well-supported FOSS tools (if you are a beginner and are in it for $$ or productivity), and there are various groups depending on what your needs are.

FOSS gives you the most leverage, of course. To consider an example, even with several huge monopolies, Microsoft cannot knock various established FOSS platforms on their derrieres. These are only growing stronger. D may very well become a force to reckon with in 5 years.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 86.108.126.156] on January 27, 2008 03:36 PM
i have 15 years experience in c/c++ /unix/networking programming but i have to agree that managed code is the way to go and that .NET is really a great outstanding framework but luckily we have MONO so you dont have to use microsoft tools.

#

New D language pumps up programmer productivity

Posted by: Anonymous [ip: 62.47.179.62] on March 04, 2008 06:42 AM
Coming from a C++/Delphi/C# background, I've played around with D for a while. It is a fantastic language, but lacks any industry support. That's why I think it's not going anywhere.

My time is limited. I can either play around with a new language, or make money using something established.


#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya