Flexible Default Function Parameters via structs with Nullable Fields

Posted on

The problem Sometimes we need to combine an aggregate of a set of values with an aggregate of the corresponding set of default values to create a combined result. The result for each member is either the explicitly specified value or, where no value is specified, the default value. This is similar to default function … Continue reading Flexible Default Function Parameters via structs with Nullable Fields

Read more...

DStep 1.0.0

Posted on

DStep is a tool for automatically generating D bindings for C and Objective-C libraries. This is implemented by processing C or Objective-C header files and outputting D modules. DStep uses the Clang compiler as a library (libclang) to process the header files. Background The first version of DStep was released on the 7th of July, … Continue reading DStep 1.0.0

Read more...

Project Highlight: DPP

Posted on

D was designed from the beginning to be ABI compatible with C. Translate the declarations from a C header file into a D module and you can link directly with the corresponding C library or object files. The same is true in the other direction as long as the functions in the D code are … Continue reading Project Highlight: DPP

Read more...

Memoization in the D Programming Language

Posted on

The D programming language provides advanced facilities for structuring programs logically, almost like Python or Ruby, but with high performance and the higher reliability of static typing and contract programming. In this article, I will describe how to use D templates and mixins for memoization, that is, to automatically remember a function (or property) result. … Continue reading Memoization in the D Programming Language

Read more...

Using const to Enforce Design Decisions

Posted on

The saying goes that the best code is no code. As soon as a project starts to grow, technical debt is introduced. When a team is forced to adapt to a new company guideline inconsistent with their previous vision, the debt results from a business decision. This could be tackled at the company level. Sometimes … Continue reading Using const to Enforce Design Decisions

Read more...

Containerize Your D Server Application

Posted on

A container consists of an application packed together with all of its required dependencies. The container is run as an isolated process on Linux or Windows. The Docker tool has made the handling of containers very popular and is now the de-facto standard for deploying containers to a cloud environment. In this blog post I … Continue reading Containerize Your D Server Application

Read more...

Writing a D Wrapper for a C Library

Posted on

In porting to D a program I created for a research project, I wrote a D wrapper of a C library in an object-oriented manner. I want to share my experience with other programmers. This article provides some D tips and tricks for writers of D wrappers around C libraries. I initially started my research … Continue reading Writing a D Wrapper for a C Library

Read more...

Lost in Translation: Encapsulation

Posted on

D programmers come from a variety of programming backgrounds, C-family languages perhaps being the most common among them. Understanding the differences and how familiar features are tailored to D can open the door to more possibilities for organizing a code base, and designing and implementing an API. This article is the first of a few that will examine D features that can be overlooked or misunderstood by those experienced in similar languages.

Read more...

DMD 2.083.0 Released

Posted on

Version 2.083.0 of DMD, the D reference compiler, is ready for download. The changelog lists 47 fixes and enhancements across all components of the release package. Notable among them are some C++ compatibility enhancements and some compile-time love. C++ compatibility D’s support for linking to C++ binaries has been evolving and improving with nearly every … Continue reading DMD 2.083.0 Released

Read more...

Interfacing D with C: Arrays Part 1

Posted on

When interacting with C APIs, it’s almost a given that arrays are going to pop up in one way or another (perhaps most often as strings, a subject of a future article in the “D and C” series). Although D arrays are implemented in a manner that is not directly compatible with C, the fundamental building blocks are the same. This makes compatibility between the two relatively painless as long as the differences are not forgotten. This article is the first of a few exploring those differences.

Read more...