| ▲ | 9rx 2 days ago | |
Not quite. With OO, there is no set. An object always responds to all messages, even when the message contains arbitrary garbage. An object can respond with "I don't understand" when faced with garbage, which is a common pattern in OO languages, but it doesn't have to. An object could equally respond with a value of 1 if it wants. Dynamic typing is a necessary precondition for OO[1], but that is not what defines it. Javascript, for example, has objects and is dynamically typed, but is not OO. If I call object.random_gibberish in Javascript, the object will never know. The runtime will blow up before it ever finds out. Whereas in an OO language the object will receive a message containing "random_gibberish" and it can decide what it do with it. [1] Objective-C demonstrated that you can include static-typing in a partial, somewhat hacky way, but there is no way to avoid dynamic-typing completely. | ||