How designing Carbon with C++ interop taught me about C++ variadics and overloads

C++ has some amazing and powerful language features, but they can be difficult to understand. Moving past a basic understanding of a feature and common patterns of use requires a deep understanding of the underlying language design so that you can model how it works and how to effectively use it. But how do you develop a rich and compelling model for these parts of C++?

The Carbon language aims for seamless and comprehensive interop with C++, including these complex and powerful aspects of the language. As a consequence, in order to design Carbon's features, we have to build exactly that rich and compelling model for C++ features they interoperate with. A surprising but delightful outcome is that the Carbon designs can often be used to build an even deeper and more effective understanding of C++ itself.

This talk will work through the design of two Carbon features with significant C++ overlap: variadics and overloaded methods. We will build up a design model for them, and show how you can use that model to think more deeply and holistically about the design of C++ code. It will also show how to build more expressive or robust C++ APIs through that model, even where C++ doesn't give you perfect building blocks. And most of all, it will showcase a fun and interesting way to learn about language design, and reason more deeply about the underlying principles of your code.

Image

Chandler Carruth

Chandler Carruth is the technical lead for Google's programming languages and software foundations. He has worked extensively on the C++ programming language and the Clang and LLVM compiler infrastructure. Previously, he worked on several pieces of Google's distributed build system and made guest appearances helping maintain a few core C++ libraries across Google's codebase. He received his M.S. and B.S. in Computer Science from Wake Forest University, but disavows all knowledge of the contents of his Master���s thesis. When not hammering away on a weirdly shaped keyboard, he enjoys sushi, fine dining, brown spirits, and everything about wine.

When

July 21-24, 2024

LinkedIn

CppNorth Group