You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current dataone implementation creates S4 methods as anonymous functions. This has some side effects, including that 1) stack traces use ".local" as the function name, which isn't very informative, and 2) programming clients can't use method lookups to do autocomplete. We should consider eliminating the use of anonymous functions, replacing them with real functions. Our current approach is like this:
setMethod("foo", signature("character"), function(x) {
# do something with x
print(x)
})
which might be replaced with:
foo_<-function(x) {
# do something with x
print(x)
}
setMethod("foo", signature("character"), foo_)
I'm not sure if this approach helps much with autocomplete. It also creates a whole bunch of functions that we don't actually want exported because they shadow the methods.
Also, in the latter approach, I am not sure where the roxygen docs would go, on the function def or on the setMethod() call. Probably before the function, but I'm not sure.
@amoeba, @cboettig, and @gothub: what are your thoughts on what the best course of action would be?
The text was updated successfully, but these errors were encountered:
Note that I tested it out in ropensci/datapack#130 and 1) the private method is not exported and so isn't a problem, and 2) roxygen is perfectly happy with the docs on the setMethod calls, so we can leave that as is.
The current
dataone
implementation creates S4 methods as anonymous functions. This has some side effects, including that 1) stack traces use ".local" as the function name, which isn't very informative, and 2) programming clients can't use method lookups to do autocomplete. We should consider eliminating the use of anonymous functions, replacing them with real functions. Our current approach is like this:which might be replaced with:
I'm not sure if this approach helps much with autocomplete. It also creates a whole bunch of functions that we don't actually want exported because they shadow the methods.
Also, in the latter approach, I am not sure where the roxygen docs would go, on the function def or on the setMethod() call. Probably before the function, but I'm not sure.
@amoeba, @cboettig, and @gothub: what are your thoughts on what the best course of action would be?
The text was updated successfully, but these errors were encountered: