Sign up
Forgot password?
FAQ: Login

D Programming Language

  • pdf file
  • size 957,78 KB
D Programming Language
This document is an unofficial snapshot of the official online documents and was created and posted with the permission of Walter Bright.
"It seems to me that most of the "new" programming languages fall into one of two categories: Those from academia with radically new paradigms and those from large corporations with a focus on RAD and the web. Maybe it's time for a new language born out of practical experience implementing compilers. " — Michael
"Great, just what I need. another D in programming. " — Segfault.
This is the reference document for the D programming language. D was conceived in December 1999 by myself as a successor to C and C++ and has grown and evolved with helpful suggestions and critiques from my friends and colleagues. I've been told the usual, that there's no chance for a new programming language, that who do I think I am designing a language, etc. Take a look at the document and decide for yourself!
The D newsgroup in news.digitalmars.com server is where discussions of this should go.
Suggestions, criticism, kudos, flames, etc., are all welcome there.
Note: all D users agree that by downloading and using D, or reading the D specs, they will explicitly identify any claims to intellectual property rights with a copyright or patent notice in any posted or emailed feedback sent to Digital Mars.
What is D?
D is a general-purpose systems and applications programming language. It is a higher-level language than C++ but retains the ability to write high-performance code and interface directly with the operating system APIs and with hardware. D is well-suited to writing medium to large-scale million-line programs with teams of developers. D is easy to learn, provides many capabilities to aid the programmer, and is well-suited to aggressive compiler optimization technology.
D is not a scripting language, nor an interpreted language. It doesn't come with a VM, a religion, or an overriding philosophy. It's a practical language for practical programmers who need to get the job done quickly, and reliably, and leave behind maintainable, easy-to-understand code.
D is the culmination of decades of experience implementing compilers for many diverse languages and attempting to construct large projects using those languages. D draws inspiration from those other languages (most especially C++) and tempers it with experience and real-world practicality.
Why D?
Why, indeed. Who needs another programming language? The software industry has come a long way since the C language was invented. Many new concepts were added to the language with C++, but backward compatibility with C was maintained, including compatibility with nearly all the weaknesses of the original design.
There have been many attempts to fix those weaknesses, but the compatibility issue frustrates it. Meanwhile, both C and C++ undergo a constant accretion of new features. These new features must be carefully fitted into the existing structure without requiring rewriting old code. The result is very complicated - the C standard is nearly 500 p. and the C++ standard is about 750 p.! The reality of the C++ compiler business is that few compilers effectively implement the entire standard.
C++ programmers tend to program in particular islands of the language, i.e. getting very proficient using certain features while avoiding other feature sets. While the code is portable from compiler to compiler, it can be hard to port it from programmer to programmer. A great strength of C++ is that it can support many radically different styles of programming - but in long-term use, the overlapping and contradictory styles are a hindrance.
It's frustrating that such a powerful language does not do basic things like resizing arrays and concatenating strings. Yes, C++ does provide the metaprogramming ability to implement resizable arrays and strings like the vector type in the STL. Such fundamental features, however, ought to be part of the language. Can the power and capability of C++ be extracted, redesigned, and recast into a language that is simple, orthogonal, and practical? Can it all be put into a package that is easy for compiler writers to correctly implement, and which enables compilers to efficiently generate aggressively optimized code?
Modern compiler technology has progressed to the point where language features to compensate for primitive compiler technology can be omitted. (An example of this would be the 'register' keyword in C, a more subtle example is the macro preprocessor in C.) We can rely on modern compiler optimization technology to not need the language features necessary to get acceptable code quality out of primitive compilers.
D aims to reduce software development costs by at least 10% by adding in proven productivity-enhancing features and by adjusting language features so that common, time-consuming bugs are eliminated from the start.
  • Sign up or login using form at top of the page to download this file.
  • Sign up
Up