ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
#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
System software versus application software
System software is designed to operate and control the hardware, and to provide a platform for running application software; e.g. operating systems, utility software, device drivers, compilers, and linkers.

System programming languages, in contrast with application languages, typically offer more direct access to the physical hardware of the machine: an archetypical system programming language in this sense was BCPL.

System programming languages often lack built-in input/output (I/O) facilities because a system-software project usually develops its own I/O mechanisms or builds on top of basic monitor I/O or screen management facilities.

e.g. PL/I, #C, C++, #Ada, #D, Nim, #Rust, #Swift