In this talk, we will explore the use of Python's `typing.Protocol`, Scala's Typeclasses, and Rust's Traits.
They all offer a very powerful & elegant mechanism for abstracting over various concepts (such as Serialization) in a modular manner.
We will compare and contrast the syntax and implementation of these constructs in each language and discuss their strengths and weaknesses. We will also look at real-world examples of how these features are used in each language to specify behavior, and consider differences in terms of type system expressiveness and effectiveness. By the end of the talk, attendees will have a better understanding of the differences and similarities between these three language features, and will be able to make informed decisions about which one is best suited for their needs.
Within simple applications abstractions are only needed to a certain degree.
E.g., why would someone need a complex class hierarchy, if the task at hand could be solved more pragmatically?
However, as applications and the business get more complex, abstractions can become crucial for improving the quality and maintainability of your code.
With `typing.Protocol` a great Python language feature was introduced, which allows abstraction and modularization while also having static typing. This allows for very robust software development.
How do other languages solve that problem?
Besides `typing.Protocol` we’ll also dive into the world of Scala Typeclasses, and Rust Traits, and explore how these features are used in each language to ensure the correctness and safety of code.
All these mechanisms have in common that they specify behavior for types in a very flexible and safe manner.