"Polymorphism Unbound" by Bruce Eckel (Strange Loop 2022)

Discover the fascinating world of polymorphism, exploring concepts such as templates, protocols, union types, and more.

Key takeaways
  • Polymorphism is the ability of an object to take on multiple forms. This can be achieved through inheritance, interface-based polymorphism, and union types.
  • Duck typing is a form of polymorphism that involves sending messages to objects without knowing their type ahead of time.
  • C++ has a concept called templates, which allows for generic programming.
  • Smalltalk has a concept called protocols, which is another way to achieve polymorphism.
  • Kotlin has a concept called extension functions, which allows for functional programming.
  • Python has a concept called protocols, which is similar to Smalltalk’s protocols.
  • Go has a concept called union types, which allows for dispatching based on the type of the variable.
  • Algebraic data types are a way to define a type that can be one of multiple subtypes.
  • Parametric polymorphism is a way to define a type that can be used with multiple types.
  • Leaving out the “questionable benefit” of having a uniform interface can lead to confusion.
  • C++’s private inheritance is different from public inheritance.
  • Go’s syntax is simpler because it has fewer keywords.
  • Smalltalk’s prototype-based programming is different from class-based programming.
  • C++’s private inheritance is confusing because it introduces a layer of complexity.
  • Kotlin’s extension functions are useful for functional programming.
  • Go’s union types are useful for dispatching based on the type of the variable.
  • C++’s templates are useful for generic programming.
  • Protections are a way to ensure that a program is safe and secure.