This post is part of an ongoing series on working with both D and C in the same project. The previous two posts looked into interfacing D and C arrays. Here, we focus on a special kind of array: strings. Readers are advised to read Arrays Part One and Arrays Part Two before continuing with… Continue reading Interfacing D with C: Strings Part One
In this continuation of the GC series, we explore what destruction means in the context of D’s support for both garbage collection and manually-managed memory.
Introduction A while ago, Andrei Alexandrescu started a thread in the D Programming Language forums, titled “Perfect forwarding”, about a challenge which came up during the July 2020 beerconf: Write an idiomatic template forward that takes an alias fun and defines (generates) one overload for each overload of fun. Several people proposed solutions. In the… Continue reading Function Generation in D: The Good, the Bad, the Ugly, and the Bolt
An introductory tutorial on templates in D. This post lays the foundation for future articles on more advanced template topics.
When Andrei Alexandrescu introduced ranges to the D programming language, the gap between built-in and user-defined types (UDTs) narrowed, enabling new abstractions and greater composability. Even today, though, UDTs are still second-class citizens in D. One example of this is support for head mutability—the ability to manipulate a reference without changing the referenced value(s). This… Continue reading A Pattern for Head-mutable Structures
Introduction It seems each time you turn around there is a new programming language aimed at solving some specific problem set. Increased proliferation of programming languages and data are deeply connected in a fundamental way, and increasing demand for “data science” computing is a related phenomenon. In the field of scientific computing, Chapel, D, and… Continue reading A Look at Chapel, D, and Julia Using Kernel Matrix Calculations
The Continental Club in Austin, Texas, USA Sunday, January 5, 1987 “Thank you for your kind invitation, Mr. Lomuto. I will soon return to England so this is quite timely.” “And thanks for agreeing to meeting me, Mister… Sir… Charles… A.R… Hoare. It’s a great honor. I don’t even know how to address you. Were… Continue reading Lomuto’s Comeback
This post is part of an ongoing series on working with both D and C in the same project. The previous post explored the differences in array declaration and initialization. This post takes the next step: declaring and calling C functions that take arrays as parameters. Arrays and C function declarations Using C libraries in… Continue reading Interfacing D with C: Arrays and Functions (Arrays Part 2)
At one time or another during application development you need to make a decision: does your application work like it should and, if not, what is wrong with it? There are different techniques to help you decide, some of which are logging, tracing, and profiling. How are they different? One way to look at it… Continue reading Tracing D Applications
After reading “Beating C With 80 Lines Of Haskell: Wc”, which I found on Hacker News, I thought D could do better. So I wrote a wc in D. The Program It consists of one file and has 34 lines and 712 characters. import std.stdio : writefln, File; import std.algorithm : map, fold, splitter; import… Continue reading wc in D: 712 Characters Without a Single Branch