Overview
Explore the power of C++'s type system in this conference talk from C++Now 2019. Learn how to leverage strong typing to create safer, more expressive code. Discover the pitfalls of using primitive types for domain values and understand the benefits of implementing custom wrapper types. Examine historical perspectives on type systems, from early programming languages to modern C++. Delve into topics such as integral promotion, numeric conversions, and the challenges posed by C++'s legacy. Gain insights into implementing and teaching simple wrapper types, and explore a work-in-progress framework for mixing in operators safely. Understand how proper domain types can enhance code clarity and prevent common errors, using examples from the standard library and real-world scenarios. Apply the Whole Value Pattern to improve function interfaces and reduce bugs caused by parameter confusion.
Syllabus
Intro
What are types
Historical languages
First programming experience
Second programming experience
Pascal
what is a type system
whats a type system
type system
strong
explicit vs implicit
What can go wrong
Benefits of the Type System
The Lack of Types
Integral Promotion
Strong Type System
Member Functions
enums
library fails
the whole value pattern
Dont use primitive types
Taught by
CppNow