RSSAmplifier

Blog

Átila on Code

Code, testing and systems programming

atilaoncode.blogRSS feed ↗10 posts

Latest posts

Seriously, just use D to call C from Python

Last week I suggested that if you want to call C code from Python that you should use D. I still think that 4 lines of code (two of which are header includes) and a build system is hard to beat if that indeed is your goal. The internet, of course, had different ideas. I [ ]

Want to call C from Python? Use D!

In my last blog post I wrote about the power of D s compile-time reflection and string mixins, showing how they could be used to call D from Python so easily it might as well be magic. As amazing as that may be for those of us who have D codebases we want to expose to [ ]

The power of reflection

When I was at CppCon 2016 I overheard someone ask Everyone keeps talking about reflection, but why do we actually need it? . A few years before that, I also would have had difficulty understanding why it would be useful. After years of writing D, it s hard to imagine life without it. Serialisation is an obvious [ ]

Type inference debate: a C++ culture phenomenon?

I read two C++ subreddit threads today on using the auto keyword. They re both questions: the first one asks why certain people seem to dislike using type inference, while the second asks about what commonly taught guidelines should be considered bad practice. A few replies there mention auto. This confuses me for more than one [ ]

Boden, Flutter, React Native?

A while back I had an idea for a mobile app that I still might write. The main problems were finding the time and analysis paralysis: what do I write the project in? I ve done some Android development before using Qt, and it was a hassle. I ve been told that JNI was made painful on [ ]

Build systems are stupid

Big complicated projects nearly always need a build system. They might be generating code. They might be compiling different branches depending on the platform or a build-time configuration option. They might turn on/off unity builds for C++. For most simple projects however, build systems are stupid. Let s say you have a single C file. We [ ]

My DConf2019 talk

I ll be speaking at DConf this year. I haven t yet decided how to structure the talk yet, but I d like to take a page out of Dan Sak s excellent CppCon 2016 talk that covered technical and psychological aspects of language adoption. In his case he was addressing a C++ audience on the difficulty of convincing [ ]

When you can’t (and shouldn’t) unit test

I m a unit test aficionado, and, as such, have attempted to unit test what really shouldn t be. It s common to get excited by a new hammer and then seeing nails everywhere, and unit testing can get out of hand (cough! mocks! cough!). I still believe that the best tests are free from side-effects, deterministic and [ ]

Issues DIP1000 can’t (yet) catch

D s DIP1000 is its attempt to avoid memory safety issues in the language. It introduces the notion of scoped pointers and in principle (modulo bugs) prevents one from writing memory unsafe code. I ve been using it wherever I can since it was implemented, and it s what makes it possible for me to have written a [ ]

The joys of translating C++’s std::function to D

I wrote a program to translate C headers to D. Translating C was actually more challenging than I thought; I even got to learn things I didn t know about the language even though I ve known it for 24 years. The problems that I encountered were all minor though, and to the extent of my knowledge [ ]