RSSAmplifier

Blog

Programming in D

Programming with the D programming language

ddili.orgRSS feed ↗82 posts

Latest posts

'deprecated', 'extern', and 'extern()'

Added 'deprecated' that helps with deprecation process of library features, 'extern' that is for declaring external symbols, and 'extern()' that allows interacting with libraries of other languages (extern(C), extern(C++, std), etc.).

Code Samples .zip File

You can download most of the code samples that appear in the book as a .zip file.

Book Index

The index section of the book.

Fibers

Cooperative multitasking in D with fibers.

Pragmas

Pragmas that allow interactions with the compiler, including the most recent pragma(inline).

Operator Precedence

The rules that specify the execution order of chained operators and the expressions that they use.

Foreword by Andrei Alexandrescu

"Instead of falling for getting things done quickly, 'Programming in D' focuses on getting things done properly, to the lasting benefit of its reader."

'.offsetof' property and 'align' attribute

The .offsetof property to get the offsets of and the align attribute to specify the alignments of struct members.

Contract inheritance

Inheriting 'in' and 'out' blocks of interface and class functions.

The special keywords

__MODULE__, __FILE__, __LINE__, __FUNCTION__, and __PRETTY_FUNCTION__

pragma

The pragma directive

Nested Functions, Structs, and Classes

Defining functions, structs, and classes inside existing scopes.

Lvalues and Rvalues

Lvalues, rvalues, their differences, and 'auto ref' parameter type that can accept either kind.

The 'Index' section

Automatically generated index section for the PDF version of the book.

The attributes of Throwable

The attributes of the Throwable interface, collateral exceptions, and an example of accessing collateral exceptions through the .next property.

@disable

The @disable attribute to disable special functions of structs.

User Defined Attributes (UDA)

Assigning user defined attributes to type and variable declarations, testing the attributes at compile time, and compiling the program according to those attributes.

Type traits

Using type traits in conditional compilation.

Data Sharing Concurrency

Multi-threaded programming in D by data sharing.

More Ranges

Useful range templates of the std.range module. Providing range capabilities depending on the capabilities on dependent ranges.

Mixins

Template and string mixins that allow inserting compile-time generated code into the source code.

More Functions

More features of D functions: auto, ref, auto ref, and inout return attributes; pure and nothrow behavioral attributes; and @safe, @trusted, and @system memory safety attributes.

Tuples

Tuples, which combine values of different types and make them available similar to struct objects, and TypeTuple, which represents the concept of 'list of values' as seen in parameter lists, template argument lists, and array literal initialization lists.

Ranges

The code examples in the Ranges chapter are made const-correct and they take advantage of UFCS.

Labels and goto

Labels that give names to code lines and the goto statement that make program execution go to a label.

Unions

Sharing the same memory area for multiple members.

foreach with Structs and Classes

Providing foreach support for structs and classes.

Function Pointers, Delegates, and Lambdas

Function pointers and delegates allow storing how the program should behave at a later time. Lambdas (anonymous function or function literals) make code more readable and reduce boilerplate code.

is Expression

is expression, one of the most powerful compile-time features of the D programming language.

Bit Operations

The D features that enable manipulating data bit-by-bit.

Pointers

Pointers are variables that provide access to other variables. They are low-level capabilities of the microprocessor.

alias this

'alias this' enables automatic type conversions of user-defined types.

alias

'alias' assigns aliases to existing names

Properties

Properties allow using member functions like member variables.

Universal Function Call Syntax (UFCS)

UFCS enables the member function syntax even for regular functions.

Encapsulation and Protection Attributes

Preserving class invariants by limiting access to class members.

destroy and scoped

'destroy()' to call destructors explicitly and 'scoped()' to destroy objects automatically.

Interfaces

The 'interface' keyword to define class interfaces.

Object

The Object class that is at the top of class hierarchies and its member functions toString(), opEquals(), opCmp(), and toHash().

Inheritance

Inheriting the members of existing classes.

Classes

The 'class' feature of the D programming language, which supports the object oriented programming (OOP) paradigm.

Operator Overloading

Defining the behaviors of operators for structs to allow their uses as convenient as the fundamental types.

Message Passing Concurrency

Receiving LinkTerminated and OwnerTerminated exceptions as messages.

Parallelism

Explain the parameters of the functions of the std.parallelism module: Work unit size and buffer size.

Immutability

The consequences of marking function parameters const or immutable.

const ref Parameters and const Member Functions

Marking parameters as 'const ref' and member functions as 'const' in order to be able to use them with immutable variables as well.

Member Functions

Defining functions that are closely related to a struct inside the curly brackets of that struct definition.

Function Overloading

The function overloading feature that enables defining multiple functions having the same name.

Variable Number of Parameters

Default parameter values and variadic functions.

Structs

The 'struct' feature for defining higher-level concepts as user-defined types.