v3 flag enabled
Log In
Log In

Improving libraries through Boost review process: the case of OpenMethod

Blog

Since 2013, I have been working on libraries that implement open multi-methods in modern C++. After releasing the first one - YOMM11 - I asked on the Boost mailing list if there was an interest in bringing YOMM11 into Boost. Back then there was not much.

I made another attempt when I released the much improved YOMM2, but interest was still feeble. Or maybe I did not explain what it was about well enough.

Anyway, I continued improving YOMM2 as a stand-alone project, and, in retrospect, I now think that it was for the best, at the time. YOMM2 had a bunch of users, engaged enough to send me PRs, and did not cause much trouble in terms of bugs. As for its internals, let's say, they looked like an experiment in progress.

Over the years, though, I cleaned up the implementation. Following discussions on reddit, I raised the bar in terms of features, performance, footprint, etc. For example, I added support for custom RTTI.

I talked about YOMM2 at conferences once in a while. In 2024, I attended "using std::cpp", organized by Prof J.D. Garcia at the Universidad Carlos III in Madrid. Joaquín M López Muñoz was giving a talk about perfect hashing, a technique that is used in YOMM2. Prof Garcia introduced me to Joaquín, and I told them the story of my library, and about my interactions with the Boost community.

It turned out that Joaquín was a Boost author himself. He suggested that I try again, offering to endorse me. That would secure me a formal review. I said I would think about it.

I decided to go ahead for several reasons. I admit that vanity was one of them! But I also had "better" motives. I felt that I was not having a lot of success making the C++ community aware of my work. I figured having it in Boost would help. The most important reason was...well, I am 62, with a couple of health issues. Probably I'll still be around for some time, but, just in case, I would like to give my library a chance to outlive me, as long as possible. And Boost has been very good at conserving C++ libraries, even as authors and maintainers come and go.

Dmitry Arkhipov, a member of C++ Alliance (like Joaquín), offered to manage the review. It turns out that he needed open multi-methods in a past project. He would have used YOMM2, if only he had known that it existed.

I did another round of cleanups, during which I moved some internals (like virtual_traits) to the public interface, refining them in the process.

Should the library be accepted, it would go by the name Boost.OpenMethod.

The review started. To be honest, I was steeling myself, expecting indifference. To the contrary, after a few days, comments, then formal reviews started flowing in (a formal review must follow a format, in particular it must clearly vote "accept", "accept with conditions", or "reject").

All the comments, reviews, and the debates they triggered, were very interesting. They honed my designs further. For example, I redesigned the policy system (an important set of customization points that supports things like custom RTTI).

Only one reviewer voted for rejection. Nonetheless, the conversation with him was just as stimulating. Like others, and more strongly than others, he criticized a feature that I ended up relegating to an opt-in.

I will try to describe it without going into too many details. My library is strongly inspired by papers that Stroustrup and col wrote while attempting to bring open multi-methods into the C++ standard. In their last paper on the subject (google for N2216), they suggest a treatment of ambiguities that essentially makes them non-errors. I disliked the idea, and YOMM2 never implemented it, but I (sheepishly) adopted it for OpenMethod. And almost everybody disliked it! Mistake avoided.

Some reviewers showed an astonishing grasp of low level details of the implementation. I was delighted when Steven Watanabe dropped two pieces of code that interface OpenMethod with Boost.Any and Boost.TypeErasure.

At the end of the review, OpenMethod was accepted with conditions - a few changes that I completely agreed with. But even if it had been rejected, it would have been well worth the journey. OpenMethod is a much better library than YOMM2. And it was accepted!

OpenMethod will join the flock in the Boost 1.90.0 release.

Next Post