The Imperatives Must Go! [Functional Programming in Modern C++] - Victor Ciura - CppCon 2022

Discover how to bring functional programming principles to modern C++ development, exploring topics like composition, higher-order functions, and monads to create more concise and expressive code.

Key takeaways
  • Functional programming is not limited to specific languages, but is a style of programming that can be applied to any language.
  • C++ is a multi-paradigm language that has already been influenced by functional programming.
  • Functional programming is about composition of functions, rather than sequencing of statements.
  • Lifting functions allows for the creation of higher-order functions that can be composed together.
  • Monads are a way to combine multiple operations together in a single function.
  • The idea of boxing values, such as using optional vs. unique_ptr, can help with function composition.
  • The FMAP concept allows for the transformation of a function from one type to another.
  • Functional programming can be used to create more concise and expressive code.
  • The use of higher-order functions, such as when_all and when_any, can simplify code.
  • The concept of piping functions together, similar to the Unix pipe, can be used in C++.
  • The use of type constructors, such as optional and vector, can help with function composition.
  • Functional programming can be used to create more rigorously designed code.
  • The use of monads can help with error handling and exception handling.
  • The concept of Schrödinger’s cat programming refers to the idea of dealing with uncertainty and uncertainty principles in programming.
  • C++ has become a more functional programming language over time, with the introduction of features like ranges and coroutines.