Monday, September 17, 2012

D Programming Language

 
A, B, C,...D! Programming Language



I. Formal Definition
           The D programming language is an object-oriented, imperative, multi-paradigm system programming language and is originated as a re-engineering of C++. Even though it is mainly influenced by that language, D has redesigned some C++ features and has been influenced by concepts used in other programming languages, such as Java, Python, Ruby, C#, and Eiffel. In addition, D is a language with C-like syntax and static typing which pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity. 


 II.  History
Walter Bright is a computer programmer known for being the designer of the D programming language. He decided to start working on this language in 1999 and was first released in December 2001. In January 2007, D reached version 1.0 which concentrated on the imperative, object oriented and meta-programming paradigms, similar to C++. D community created an alternative runtime and standard library in which they named as Tango. 

In June 2007, version 2.0 was released. The beginning of D 2.0's development signaled the stabilization of the first version of the language since it is been in maintenance, only receiving corrections and implementation bug fixes. D 2.0 added numerous other language features, such as closures, purity, and support for the functional and concurrent programming paradigms. D 2.0 also solved standard library problems by separating the runtime from the standard library. The completion of a D 2.0 Tango port was announced in February 2012.



III. What does it do? 

  • Binary C Compatibility
               D programs can import and link against C code and libraries, providing D with free access to a huge amount of pre-written code. Note, however, that D is not link-compatible with C++, so pure C wrappers are required to access C++ code in D.
  • Systems Programming
             Because D is compiled to binary rather than bytecode, and it does not run inside a virtual machine, D can be used for systems and low-level programming. It allows in-line assembly, and the garbage collector can be regulated (or even disabled) if real-time capabilities are necessary.
  • Lexicial, Syntactic, and Semantic Clarity
            One of the major goals of D is to eliminate a lot of the complexity of C++ that has made it so hard for compilers to live up to the standard. A simplified syntax makes the job of both the compiler and the programmer easier, as it allows compilers to be more efficient and reduces the likelihood of compiler bugs. As an example, D drops the much-contested angular bracket syntax for declaring templates, making code easier both to read and parse.
  • Design-by-Contract and Automatic Testing
            D advocates the use of design-by-contract and provides built-in facilities for automatic unit-testing. While both are technically possible in C++, D makes them core tenets of the language to make them easier to use for novices. The hope is that with testing built into the language bugs will be easier to identify and fix, especially if programmers get into the habit of using the testing features.
  • Removal of Archaic Features
            Probably the language's greatest goal is the elimination of archaic and/or needlessly complicated features. For instance, D does away completely with the C preprocessor, relying instead on built-in versioning capabilities. Forward declarations are out the window on the same token. Also, it replaces the often-complicated multiple inheritance of C++ with Java's single inheritance and interfaces. Most of these features are also related with the above of clarity, making the code easier for a human to read as well as easier for a compiler to convert into binary.



Some addition on its features:
         
           The inline assembler typifies the differentiation between D and application languages like Java and C#. It allows a programmer to enter machine-specific assembly code alongside standard D code—a technique often used by systems programmers to access the low-level features of the processor needed to run programs that interface directly with the underlying hardware, such as operating systems and device drivers. Built into the language is a documentation generator called Ddoc.


IV. Advantages


  • D allows writing large code fragments without redundantly specifying types, like dynamic languages do.
  • Automatic memory management makes for safe, simple and robust code.
  • Built-in linear and associative arrays, slices and ranges make daily programming simple and pleasant for tasks, both small and large.
  •  

V. Disadvantages 
  •  It is not predictable when a collection gets run, so the program can arbitrarily pause.
  • The time it takes for a collection to run is not bounded. While in practice it is very quick, this cannot be guaranteed.
  •  All threads other than the collector thread must be halted while the collection is in progress.





VI. Sample Code

Hello World Program
 

Factorial Program


Fibonacci Sequence Program



VII. Updates / Recent News

DFL 0.9.8 release


Highlights include:
  • ToolBar control added.
  • ImageList added, including image support to controls ToolBar, ListView and TreeView.
  • Now works with version 2 D compilers! but this is not officially supported since D 2.x is a moving target.
  • Updated support for D compilers and Tango library.
Check this link for further details: http://www.dprogramming.com/dfl.php



VIII. Shoutouts! 
     “It seems to me that most of the ‘new’ programming languages fall into one of two categories: Those from academia with radical 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

"I have heard of D but never really bothered to read about its salient features. I was hoping to learn something from your posting on D but unfortunately there isn’t much (I will follow the links you provide). Dare I say, compiler writing and language design are orthogonal skills? It might be better to characterize Walter as a talented language designer." -- PhilM

IX. Sources

http://www.informit.com/articles/article.aspx?p=1381876
http://en.wikipedia.org/wiki/D_(programming_language)
http://digitalmars.com/d/1.0/index.html
http://www.dprogramming.com/
http://en.wikibooks.org/wiki/D_Programming#gdc
http://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Lesson_6
http://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Intro_to_Functions
http://progopedia.com/language/d/
http://thecybershadow.net/d/Memory_Management_in_the_D_Programming_Language.pdf
http://progopedia.com/example/factorial/140/
http://www.docwiki.net/view.php?pageid=92
http://lambda-the-ultimate.org/node/2421
http://www.johndcook.com/blog/2012/04/12/d-programming-language/


X. Credits

Members: CMSC 124 T-6L

Abelardo, Darwin James A. 2010-60334
Dimacuha, Samantha Patricia A. 2010-56586
Flores, Paulene Nicole DC. 2010-50427
Gasis, Christian Ray B. 2010-01699
 


No comments:

Post a Comment