Refactoring the D Koans with metaprogramming

💡 The problem Welcome back, it’s been quite a long time since my last ramblings on the D Programming Language! This post is born from a necessity. An old project of mine, the D Koans, was using an external library to simplify unit testing, which is more or less the core of the whole project. Unfortunately, the library started giving some deprecation warnings when compiled with recent D versions. Since the D Language already has an internal unit testing framework, I thought it would be nice to remove the single dependency and rely only on the standard library. Initially, with some global search/replace, I managed to convert all the tests to unittest blocks. ...

May 21, 2025 · Andrea Manzini

Debriefing Advent of Code 2024

🎄 Intro After a very interesting and fun SUSE hackweek, as every December since some years, I took part to Advent of Code. First of all, I wish to thank Eric Wastl because he’s giving us every year a great and unforgettable advent-ure. [image source: Reddit u/edo360 ] ✨ What’s Advent of Code ? More than just a countdown to Christmas, AoC is a joyful game that invites developers of all age and levels to sharpen their problem-solving abilities and coding skills. Like a virtual advent calendar, AoC presents a new programming puzzle each day from December 1st to 25th. These puzzles are often deceptively simple at first glance, but they quickly unfold into intricate challenges requiring clever algorithms and efficient code. ...

December 26, 2024 · Andrea Manzini

a 'pythonic' fileinput module for the D programming language

When I write small command line utilities in Python, I often take advantage of the fileinput module that makes working with text files very convenient: the library permits to write quickly and easily a loop over standard input or a list of files, something like perl -a or awk line processing. Then the size of input data grew, and also for a language comparison, I wanted to port my utility in the D programming language, but I cannot find an equivalent module, so I decided to write one myself. ...

January 25, 2021 · Andrea Manzini

Hijack C library functions in D

I like playing with the D programming language and I wrote this little post to show how it’s easy to create a dynamic library (shared object, .so) that can be invoked in other programs; to have a little fun we will write a D replacement for the rand() C standard library function call. For your convenience, all the code is also on github Let’s start with the demo implementation, a C program that calls 10 times the stdlib function rand() to get a random number. ...

March 10, 2020 · Andrea Manzini