G'day Terry, On Mon, 26 Aug 2024 09:42:10 -0500 "Therneau, Terry M., Ph.D. via R-devel" <r-devel@r-project.org> wrote:
[...] > I now get "bug reports" from the growing segment that believes one > should put packagename:: in front of every single instance. [...] > What are other's thoughts? Not that I want to start a flame war, or say anything controversial, but IMHO people who want to put packagename:: in front of every function do not understand S3 method dispatch and are just clutching at a comfort blanket that sets them up for failure. ;-) Admittedly, it is now quite a while back that I had the joy of debugging the following situation (but it happened at least twice in this millennium if memory serves correctly): * Author of package X relies on foo(bar) to be dispatched to foo.default(). * Author of package Y loads a zillion packages, one of which defines (and registers) a method foo.bar() * User first attaches package X and then package Y (well, order does not really matter). There is no warning about masked functions (why would there be?) or anything else. * User calls function in package X that relies on foo(bar) to be dispatched to foo.default(), but it is now dispatched to foo.bar(). * foo.bar() returns something different to foo.default() on an object of class bar and, hence, all hell breaks lose in the function in package X that used the call foo(bar). And you can put packagename:: in front of every function call in package X (and Y and Z &c) until the cows come home and it would not avoid this problem. Sorry, but except if the "put package:: in front of every function" crowd does not also start advocating that generics are not be used but rather the desired method be called directly, I don't think they can be taken seriously. Just my 0.02 (Australian of course). Cheers, Berwin ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel