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

a very simple NTP client in D

I am quite a fan of the D programming language and I think it deserves more attention, even if since a few months it’s becoming more and more popular, as it gained top20 in the TIOBE Index for February 2020. As an experiment in network programming, I took this simple NTP client written in C and translated to D ; in my opinion while it’s keeping the low-level nature, it’s shorter, clearer and more effective....

February 20, 2020 · Andrea Manzini

A new project to learn the D Programming Language

I’ve started a new side project named D Lang Koans, it’s a simple series of exercises organized in a unit test suite. The “koans” are heavily inspired by similar projects for other languages, but I didn’t found anything similar for D. I’ll try to maintain and evolve it in the spare time, I hope you’ll find it useful.

December 7, 2014 · Andrea Manzini