3 ms·
there is nothing wrong with asking if provided object is more capable than it seems so we can perform more efficient logic on it. that has nothing to do with ma
by hknmtt 4y ago
there is nothing wrong with asking if provided object is more capable than it seems so we can perform more efficient logic on it. that has nothing to do with magic methods, numbers... no magic whatsoever. "magic" in code refers to usually hidden and/or fixed behavior. this is not even in the same ballpark.
- doctor_eval 4y ago> there is nothing wrong with asking if provided object is more capable than it seems so we can perform more efficient logic on it. There certainly is something wrong if you can’t see this in the API declaration. Some Go stdlib calls declare that they accept one interface, but then test the passed in object against another, unrelated interface, which provides additional functionality. Because the second interface is undeclared and hard coded, the functionality is hidden from the user, who has to somehow know about the inner workings of the API in order to benefit from it. > "magic" in code refers to usually hidden and/or fixed behavior. Which is exactly what is happening in this case.