Re: [Rd] Improving user-friendliness of S4 dispatch failure when mis-naming arguments?

2023-08-10 Thread Hadley Wickham
Hi Michael, I can't help with S4, but I can help to make sure this isn't a problem with S7. What do you think of the current error message? Do you see anything obvious we could do to improve? library(S7) dbGetQuery <- new_generic("dbGetQuery", c("conn", "statement")) dbGetQuery(connection = NULL

Re: [Rd] Improving user-friendliness of S4 dispatch failure when mis-naming arguments?

2023-08-10 Thread Michael Chirico via R-devel
I forwarded that along to the original reporter with positive feedback -- including the argument names is definitely a big help for cuing what exactly is missing. Would a patch to do something similar for S4 be useful? On Thu, Aug 10, 2023 at 6:46 AM Hadley Wickham wrote: > > Hi Michael, > > I c

Re: [Rd] Improving user-friendliness of S4 dispatch failure when mis-naming arguments?

2023-08-10 Thread Gabriel Becker
I just want to add my 2 cents that I think it would be very useful and beneficial to improve S4 to surface that information as well. More information about the way that the dispatch failed would be of great help in situations like the one Michael pointed out. ~G On Thu, Aug 10, 2023 at 9:59 AM M

[Rd] as.matrix.dist patch (performance)

2023-08-10 Thread Tim Taylor
Please find attached a small patch to improve the performance of as.matrix.dist().  It's a tiny bit more involved than the current code but does bring a reasonable speed improvement for larger objects (remaining comparable for smaller ones). Example: set.seed(1) dat <- matrix(rnorm(2), n

Re: [Rd] feature request: optim() iteration of functions that return multiple values

2023-08-10 Thread Greg Snow
Another option that is similar to Enrico's is to use object oriented programming with R6 or reference objects. I prefer the R6 package (which will still use an environment like Enrico, but with some different syntax and a little easier if you want to do this multiple times. Here is some example c

Re: [Rd] Improving user-friendliness of S4 dispatch failure when mis-naming arguments?

2023-08-10 Thread Michael Chirico via R-devel
Here's a trivial patch that offers some improvement: Index: src/library/methods/R/methodsTable.R === --- src/library/methods/R/methodsTable.R (revision 84931) +++ src/library/methods/R/methodsTable.R (working copy) @@ -752,11 +752,12