Is D so powerfull ??
ZombineDev via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 7 06:24:59 PST 2015
On Saturday, 7 November 2015 at 12:49:18 UTC, BSaidus wrote:
> I've heard about Dlang 2 years ago, and I discovered it about 3
> * I wonder if it is so powerfull as C ?
> * Is it portable (crosse plateform) ?
> * Can I do anything with it ?
> Excuse me for for these questionsn i'm a begginer.
> It seems that I begin like it so, reconforte me please !!
D is very well supported on the major desktop platforms (Windows,
Linux, OSX, FreeBSD) and there's currently work in progress to
bring D to mobile (iOS and Android). Apart from the reference DMD
compiler, there are two other compilers that share the same
frontend, but use GCC's and LLVM's backend (GDC and LDC
respectively). There is work being done on those compilers to
extend D's reach to the support of their C++ counterparts (e.g.
embedded ARM, MIPS, etc.).
Because D's builtin types have fixed size (unlike the varying
size of e.g. C's int and long on various platforms), its ABI is
more easier to work with. D's very strong support for conditional
compilation makes abstracting platform specific code easier than
You can do in D anything that you can in C, so D is at least as
powerful as C is.
Actually, the D is much more powerful than C, because the support
for this style of programming is only a small part of D.
C procedural system programming (pointer arithmetic, void*,
function pointers, malloc, realloc, alloca, free, unions,
alignment control, static and dynamic linking with C programs and
libraries, system calls, etc.) Using these features, some
assembly bootstrap and a linker script you can make a bare-bones
Java/C# style object-oriented programming (interfaces, classes
(reference types), polymorphism, encapsulation, run-time type
information, nested/inner classes, anonymous classes, exceptions,
GC, etc.) Using these features you can develop any library or
application that would typically be written in Java / C#.
C++ style programming (structs (value types), RAII, operator
overloading, low-perf cost thin abstractions, const, templates,
containers, allocators, smart pointers, similar to STL
algorithms, nothrow, nogc, etc)
Functional programming (immutability, purity,
lambda/anonymous/nested functions, tuples, lazy algorithms,
function pipelining with UFCS, etc)
Design by contract: http://dlang.org/contracts.html
Metaprogramming, Compile-time function execution (CTFE): I don't
know if there's a definite tutorial specifically on one D's
strongest features, but here's some links to check:
https://www.youtube.com/watch?v=mCrVYYlFTrA - Desing by
https://www.youtube.com/watch?v=SqeOPLB2xAM - Declarative
programming in D
https://www.youtube.com/watch?v=xpImt14KTdc - Simplifying Code
With Compile-Time Reflection
If you are looking for a more complete overview of D's features,
you can check this feature comparison page:
What standard C does not provide and D does: calling C++ free
functions nested in namespaces, creating objects of C++ classes
(with single inheritance)
More information about the Digitalmars-d