Chapter 41. Dynamic Reception
Handle messages without defining them in the receiving class.
Also known as: Overriding method_missing or doesNotUnderstand
Any object has a limited set of methods defined for it. A client of an object may attempt to invoke a method that isn’t defined on the receiver. A statically typed language will spot this at compile time and report a compilation error. As a result, you know you won’t get this kind of error at runtime (unless you do some clever fiddling to get around the type system). With a dynamically typed language, you can invoke a nonexistent method at runtime, which usually gives you a runtime error.
Get Domain Specific Languages now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.