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
Read more...Category: Code
The ABC’s of Templates in D
Posted onAn introductory tutorial on templates in D. This post lays the foundation for future articles on more advanced template topics.
Read more...A Pattern for Head-mutable Structures
Posted onWhen 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
Read more...A Look at Chapel, D, and Julia Using Kernel Matrix Calculations
Posted onIntroduction 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
Read more...Lomuto’s Comeback
Posted onThe 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
Read more...Interfacing D with C: Arrays and Functions (Arrays Part 2)
Posted onThis 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)
Read more...Tracing D Applications
Posted onAt 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
Read more...wc in D: 712 Characters Without a Single Branch
Posted onAfter 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
Read more...D For Data Science: Calling R from D
Posted onD is a good language for data science. The advantages include a pleasant syntax, interoperability with C (in many cases as simple as adding an #include directive to import a C header file via the dpp tool), C-like speed, a large standard library, static typing, built-in unit tests and documentation generation, and a garbage collector … Continue reading D For Data Science: Calling R from D
Read more...Saving Money by Switching from PHP to D
Posted on2night was born in 2000 as an online magazine focused on nightlife and restaurants in Italy. Over the years, we have evolved into a full-blown experiential marketing agency, keeping up our vocation of spreading what’s cool to do when you go out, but specialized in producing brand events and below-the-line unconventional marketing campaigns. We started … Continue reading Saving Money by Switching from PHP to D
Read more...