4 ms·
>> but all of it is explicit if you look at the impl blocks for Vec<T>. > Well, all of Ruby's monkey-patching is explicit in the sense that you can find it if
by viraptor 9y ago
>> but all of it is explicit if you look at the impl blocks for Vec<T>.
> Well, all of Ruby's monkey-patching is explicit in the sense that you can find it if you know where to look.
There's a big difference. All impls in the first case can be found in a specific module and are listed in the generated documentation. If you want that information, there's one place to look.
In case of any monkey patching, that's not the case. It can happen literally anywhere, it can happen conditionally, and the code doesn't even have to mention the patched class since it can receive it as a parameter, which makes it impossible to even grep for.
- jopsen 9y agoSo the definition of explicit or not has to do with the computability of the question. Method resolution is not computable in a dynamic language with monkey patching. Hence, not explicit. That's a good point.
- pgwhalen 9y agoAnother way to think about it is whether the IDE can do it for you. As a Java dev (who is admittedly a bit of a slave to IntelliJ) this is a huge part of my programming experience.
- nitrogen 9y agoA heavyweight IDE is really only necessary because of the unwieldiness of Java patterns for naming and code layout. Autocompletion and navigation leads to code that is only manageable with those features in a vicious cycle.