zero-overhead C++17 currying & partial application -- Vittorio Romeo

This article briefly explains the concepts of "currying" and "partial application", then covers the design and C++17 implementation of a generic zero-overheader constexpr `curry` function.

zero-overhead C++17 currying & partial application

by Vittorio Romeo

From the article:

[...] many features introduced in the latest C++ standards allow functional patterns to thrive in your codebase, [...] like currying and partial application. [...] In this article we're going to:

* Introduce and briefly explain the two aforementioned concepts.

* Write a generic constexpr zero-overhead `curry` function in C++17.

* Analyze the generated assembly of the implementation to prove the lack of overhead.

[...]

Given a generic function object `f`, invoking `curry(f)` will return a curried/partially-applicable version of `f`. If `f` is constexpr-friendly, the returned one will be as well. `curry` should not introduce any overhead compared to hand-written currying/partial application.

Istream Idiosyncrasies -- Adi Shavit

Idiosyncrasies with istreams.

Istream Idiosyncrasies

by Adi Shavit

From the article:

A lot has been written and the vice and virtues of the C++ iostreams library.
While working on Argh, my little C++11 argument parsing library, I ran across some somewhat surprising idiosyncrasies and a few interesting lessons.

The Future of Generic Programming -- How to design good concepts and use them well -- Stroustrup

This new paper by Bjarne Stroustrup has been brewing over the holidays, and is now ready for release as a prepublication draft:

Concepts: The Future of Generic Programming
or, How to design good concepts and use them well

by Bjarne Stroustrup

From the draft paper:

Conclusions

Concepts complete C++ templates as originally envisioned. I don’t see them as an extension but as a completion.

Concepts are quite simple to use and define. They are surprisingly helpful in improving the quality of generic code, but their principles – and not just their language-technical details – need to be understood for effective use. In that, concepts are similar to other fundamental constructs, such as functions. Compared to unconstrained templates, there are no run-time overheads incurred by using concepts.

Concepts are carefully designed to fit into C++ and to follow C++’s design principles:

  • Provide good interfaces
  • Look for semantic coherence
  • Don’t force the user to do what a machine does better
  • Keep simple things simple
  • Zero-overhead

Don’t confuse familiarity and simplicity. Don’t confuse verbosity with “easy to understand.” Try concepts! They will dramatically improve your generic programming and make the current workarounds (e.g., traits classes) and low-level techniques (e.g., enable_if – based overloading) feel like error-prone and tedious assembly programming.

emBO++: Embedded C++ Conference in Bochum

embo.PNGA new embedded C++ conference will be held next month in Germany:

emBO++: Embedded C++ Conference

Bochum, Germany

From the announcement:

Worldwide there are more than one billion devices that could be thought of as embedded systems. All of them have been programmed at least once in their lives. While most systems still run plain old C-Code, a new generation of compilers, devices and language features encourage us to use more modern C++ in the world of embedded systems.

Modern C++ allows us to express ourselves better to the compiler and the hardware than ever before. It is our task, our responsibility and our passion to create better IT infrastructure. Out of this passion the emBO++ has been instantiated. A convention for developers, technologists and C++-enthusiasts. Come and join us, and let us influence more than a billion devices!