D (programming language)

The D programming language is a new evolving language in recent past. It is systems and application programming language developed by WALTER BRIGHT  of Digital Mars. It is officially released on 29 oct 2010. D is influenced by concepts used in programming languages like c++,java,python,c#. D has redesigned some features of c++.

There are two versions:
D version 1 (maintenance mode)
D version 2 (recommended for new projects).

Compilation:
It supports conditional compilation i.e. a process  of selecting which code to compile and which code to not compile. D language compiles directly to machine code, unlike the compilation of language C hence it results in faster compilation and execution of the programs.

Features:
D language deals with garbage collection,first class arrays,associative arrays,dynamic arrays,array slicing,nested functions,inner classes,lazy evaluation. The most distinguishable feature of D is its inline assembler which enables the programmers to enter machine specific assembly code within standard D code, which helps the programmers to access the low level features of  processor in order to run programs that interacts directly with underlying hardware, such as operating system, device drivers.
      These features of  D makes it a good choice for system programming....

D supports three main Programming Pradigms:

1.Imperative
2.Object Oriented
3.Metaprogramming


Imperative: The imperative programming describes computation in terms of statements. Here it is identical to C language. Functions,data,declarations are similar to C, but D additionally has a foreach loop construct which allows looping over a collection just like foreach loop in C# language.


Object oriented: This style of programming uses objects which represents real world entities. Creating collection of objects and enabling communication among them to solve the tasks is the main essence of object oriented programming. D language supports some oops concepts, but D does not support multiple inheritance
instead it uses interfaces just like java for multiple inheritance.

Metaprogramming: A metaprogram is a program that manipulates other programs (or itself). D supports metaprogramming by a combination of templates, compile time function execution and string mixins.

Example of a D program:


import std.stdio: writefln;
 
void main(string[] args)
{
    foreach (i, arg; args)
        writefln("args[%d] = '%s'", i, arg);
}
The above program prints its command line arguments. Just like in C, main() 
functionis the entry point of D program. Here D treats string as an array of 
characters and args is an array of strings representing the command line
arguments.
 
--vinay murari

0 comments:

Post a Comment