3 ms·
>Does this object have a run() method? Does it have a color property? It doesn't matter what type it is.. Only it very much matters... And to track it you hav
by coldtea 7y ago
>Does this object have a run() method? Does it have a color property? It doesn't matter what type it is..
Only it very much matters...
And to track it you have an ad-hoc, incomplete, custom, buggy, implementation of type checking in your head -- as opposed to in the program, and statically checked.
>Maybe it's a new kind of type that you could not have imagined when you first wrote the code, but if it supports the necessary method, it's going to work and you don't need to change or recompile your code to account for it.
You obviously need to change your code to have objects of that "new kind of type" (even if they are dynamic and untyped). Where would the new objects come from without changing the code in some place, the ether?
Supporting the necessary method is a very poor check for "it's going to work".
A "bomb" and a "lock" object might both have an "activate" method. You wouldn't want to call the former when you meant the latter.
You're still doing the same checks, only know you do only half of them, in your head, and whatever goes...