#language #D
D
- is a system programming language first appeared in 2001. Though it originated as a re-engineering of C++, D is a distinct language, having redesigned some core C++ features while also taking inspiration from other languages, notably Java, Python, Ruby, C#, and Eiffel.
D attempts to combine the performance and safety of compiled languages with the expressive power of modern dynamic languages. Idiomatic D code is commonly as fast as equivalent C++ code, while being shorter and memory-safe. Type inference, automatic memory management and syntactic sugar for common types allow faster development, while bounds checking, design by contract features and a concurrency-aware type system help reduce the occurrence of bugs.
Paradigms: #imperative, #object_oriented, #metaprogramming, #functional and #concurrent (actor model)
Comparison with C
Despite their difference, D has been constrained in its design by the rule that any code that is legal in both C and D should behave in the same way.
Comparison with C++
Things D gained before C++:
• closures
• anonymous functions
• compile time function execution
Things D adds:
• design by contract
• unit testing
• true modules
• garbage collection
• first class arrays
• associative arrays
• dynamic arrays
• array slicing
• nested functions
• lazy evaluation
• built-in support for documentation comments, allowing automatic documentation generation
Things D replaces:
• multiple inheritance is replaced by Java-style single inheritance with interfaces and mixins.
• template syntax is re-engineered
Things they have in common:
• D's declaration, statement and expression syntax closely matches that of C++.
• D retains C++'s ability to perform low-level coding and to add inline assembler. The inline assembler typifies the differences between D and application languages like Java and C#. An inline assembler lets programmers enter machine-specific assembly code within standard D code, a method often used by system 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.
Docs: https://dlang.org/spec/spec.html
D
- is a system programming language first appeared in 2001. Though it originated as a re-engineering of C++, D is a distinct language, having redesigned some core C++ features while also taking inspiration from other languages, notably Java, Python, Ruby, C#, and Eiffel.
D attempts to combine the performance and safety of compiled languages with the expressive power of modern dynamic languages. Idiomatic D code is commonly as fast as equivalent C++ code, while being shorter and memory-safe. Type inference, automatic memory management and syntactic sugar for common types allow faster development, while bounds checking, design by contract features and a concurrency-aware type system help reduce the occurrence of bugs.
Paradigms: #imperative, #object_oriented, #metaprogramming, #functional and #concurrent (actor model)
Comparison with C
Despite their difference, D has been constrained in its design by the rule that any code that is legal in both C and D should behave in the same way.
Comparison with C++
Things D gained before C++:
• closures
• anonymous functions
• compile time function execution
Things D adds:
• design by contract
• unit testing
• true modules
• garbage collection
• first class arrays
• associative arrays
• dynamic arrays
• array slicing
• nested functions
• lazy evaluation
• built-in support for documentation comments, allowing automatic documentation generation
Things D replaces:
• multiple inheritance is replaced by Java-style single inheritance with interfaces and mixins.
• template syntax is re-engineered
Things they have in common:
• D's declaration, statement and expression syntax closely matches that of C++.
• D retains C++'s ability to perform low-level coding and to add inline assembler. The inline assembler typifies the differences between D and application languages like Java and C#. An inline assembler lets programmers enter machine-specific assembly code within standard D code, a method often used by system 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.
Docs: https://dlang.org/spec/spec.html