3.2 Dynamic Typing
Dynamic typing relaxes the typing requirements. We let the language figure out the type based on the context.
What’s the advantage of dynamic typing? Is it worth forgoing the benefit of type verification or confirmation at compile time or code-editing time? Dynamic typing provides two main advantages, and the benefits outweigh the costs.
We can write calls to methods on objects without nailing down the details at that moment. During runtime, objects dynamically respond to methods or messages. We can achieve this dynamic behavior to a certain extent using polymorphism in statically typed languages. However, most statically typed languages tie inheritance to polymorphism. They force us to conform to a structure rather than ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access