A Type, by Any Other Name

Play A Type, by Any Other Name
Sign in to queue


No offense to Shakespeare, but in C++ there is a lot in a type name. A name represents a set of data and behaviors, and changing names is an often difficult and painful process. This could be to reconcile some repeated logic into common functionality, upgrade a hand-rolled type to a standard type (or vice-versa), or just upgrade your interfaces to be easier to use. When these types are widely used throughout a large codebase, conventional wisdom dictates that this refactoring is difficult or impossible -- changing every instance of a widesperead type would cause widespread merge conflicts, if all instances can even be found. In C++, however, it’s possible to refactor types non-atomically, in small steps which preserve invariants, without breaking any users of your code. Library teams at Google have refactored millions of lines of code this way -- this talk will outline common strategies for non-atomic renaming and refactorings, and antipatterns such as ADL use and forward declarations which complicate the process. That is: 'Tis but thy name that’s not my namespace; Thou art thyself, though not a standard class. What's montague::? It is not base, nor parent, Nor member, typedef, nor any other part Belonging to a class. O, be some other name! What's in a name? that which we call a ::rose By any other name would std::move as swift; std::romeo would, were he not ADL call'd, Retain that dear perfection which he owes Without that title. ::Romeo, doff thy name, And for that name which is no part of thee Take all myself.



Session Type:






Right click to download this episode

Download captions

The Discussion

Add Your 2 Cents