D, the Best Programming Language, for Former Python Developers
D, the Best Programming Language, for Former Python Developers
Learn D Programming for Python Developers
About the Book
D programming language or DLang for Python programmers: rapid software development of high performance software and a reliable software technology. “There is no best programming language”, they say. There is, for most applications it is D.
The book starts from a comparison of D to Python. Then it explains D starting from simple features (types, variables, functions, expressions, statements) up to advanced ones (object oriented programming, templates, mixins, contract programming, overloading of operators, etc.) Then follows an advice for good programs and introduction to several libraries: the standard library Phobos (ranges, arrays, functional programming, tuples, the variant types, files, etc.) and several other important libraries including some libraries written by the author. Through these libraries D supports asynchronous programming, multithreaded programming, dependency injection (one particular “ideologically correct” flavor of which is introduced in details), etc. This book doesn’t just teach you D syntax, it gives you some principles to program in D in the right way. It is also considered how to create an object oriented wrapper over a C library. The book contains the articles “How to Make Your Programs Run Hundreds to Thousands Times Faster Without Giving up Reliability and Ease of Programming” and “What would be my choice of programming language if I was ordered to write a nuclear weapon control system?” D is the second choice for such kinds of projects after Rust (and no, it is not Ada). The book ends with an advice on which D compiler to use.
This book makes you a D programmer. D is a very unusually good programming language for startups, academics, programming hobbyists, open source developers, big and small companies who decided to improve their efficiency and effectivity, electronics companies, game developers, system programmers, military, industry, supercomputers and mainframes. D can be used for desktop, Web development, electronics, smartphones, servers, mathematics, robots, games, GPU and AI, and even for writing an OS. If you are a programming teacher, your service would be greatly improved by starting to teach D. If you belong to any of these categories (and probably many more), don’t miss this great opportunity to learn D! And D is fast and low electricity consuming (green).
And well, there are 3 (three) free D compilers for many platforms. Just start to use it. Who does use D? For example, Facebook, Mercedes-Benz, and Netflix. Sometimes big companies make right decisions.
Purchasing this book, you support carbon accounting and DeSci (decentralized science).
Table of Contents
Advantages and disadvantages of D
Chapter 5. Functions and Variables
`scope` and `return ref` function argument modifiers
Chapter 6. Imports and Aliases
Chapter 7. Introduction to Types
By-value and by-reference types
Boolean and bitwise expressions
Assignment operator expressions
`break` and `continue` statements
Chapter 11. Functional Programming
Function pointers and delegate variables
Chapter 12. Structs and Classes
Other class features. Memory management
Abstract functions and classes
Using a class as an associative array index
Chapter 15. Exceptions and Scope Guard Statement
Array bounds and memory checking
Kind of templates. Eponymous templates
Metaprogramming with template specialization
Using mixin statement and template mixins together
Chapter 18. Documentation Comments
Chapter 20. Contract Programming
The order of function execution
Chapter 21. Static Compilation Control
Double braces in static constructs
Chapter 22. Overloading Operators
Postincrement ++ and Postdecrement -- Operators
Overloading `<`, `<=`, `>`, and `>=`
Function Call Operator Overloading f()
Assignment Operator Overloading
Op Assignment Operator Overloading
Overloading `foreach` and `foreach_reverse`
Chapter 23. Compile-Time Sequences
Chapter 25. User-Defined Attributes
Chapter 27. Advice for Good Programs
Classes, Interfaces, Structs, Unions, Enums, Non-Eponymous Templates
Chapter 28. Introduction to the Standard Library
Chapter 30. Memoizing that is caching function result in D language
std.functional.memoize from the standard library
Memoizing struct or class properties
Memoization in the D Programming Language, part 2
Chapter 31. Passing parameters through structs with nullable fields
Example of definition and combination
Chapter 32. Modify tuple modifiers
Chapter 33. Pure Dependency Injection in D
`Provider` and `ReferenceProvider`
`Callable` and `ReferenceCallable`
`BaseGeneralSingleton` and `ReferenceBaseGeneralSingleton`
`ThreadSafeSingleton` and `ReferenceThreadSafeSingleton`
`ThreadSafeCallableSingleton` and `ReferenceThreadSafeCallableSingleton`
`FixedObject` and `ReferenceFixedObject`
Chapter 34. Why I can’t call `new` from a template
Chapter 35. Writing thick (object oriented) D binding of a C library
About finalization and related stuff
Chapter 38. Which compiler should I use?
Package and/or binary availability, by platform and compiler
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them