NEWS.md
enforceRCC for setGenericS3() and setMethodS3() is now defunct in favor of argument validators.setGenericS3() produces an error if it can not turn an existing function into a “default” function and create a new generic function. Previously, it produced a warning.Now setGenericS3() sets the S3class attribute on any “default” methods it creates, if any.
Add internal function R.methodsS3:::makeNamespace(pkg) for producing S3method() statements to be put in a package’s NAMESPACE file.
R.methodsS3::setMethodS3() could produce ‘Error in appendVarArgs( …R.oo.definition) : could not find function “appendVarArgs”’ if the R.methodsS3 package is not attached.
setMethodS3() and setGenericS3() failed to detect names NA_real_, etc. as R keywords due to an 11 year old bug.
R.methodsS3::throw() is deprecated. Use base::stop(), or R.oo::throw(), instead.isGenericS4() returns FALSE for non-existing functions, just as isGenericS3() does.isGenericS3() on a function gave error “object ‘Math’ of mode ‘function’ was not found” when the methods package was not loaded, e.g. Rscript -e "R.methodsS3::isGenericS3(function(...) NULL)".
findDispatchMethodsS3() could in rare cases return an extra set of false functions in R (< 3.1.2). This was due to a bug in R (< 3.1.2) where the output of getAnywhere() contained garbage results, e.g. getAnywhere(".Options")$objs. For backward compatibility, findDispatchMethodsS3() now detects this case and works around it. This bug was only detected after adding an explicit package test for findDispatchMethodsS3().
ellipsesOnly from setGenericS3(). It was not used. Thanks Antonio Piccolboni for reporting on this.BETA: Added an in-official option to make setGenericS3() and setMethodsS3() look for existing (generic) functions also in imported namespaces. This will eventually become the default.
ROBUSTNESS: Now isGenericS3() also compares to known generic functions in the base package. It also does a better job on checking whether the function calls UseMethod() or not.
Added argument ‘inherits’ to getGenericS3().
The above improvement of isGenericS3() means that setGenericS3() does a better job to decided whether a generic function should be created or not, which in turn means createGeneric = FALSE is needed much less in setMethodS3().
capture.output() from utils which could give an error on ‘function “capture.output” not available when setMethodS3() was used to define a “replacement” function’. This was only observed on the R v3.0.1 release version but not with the more recent patched or devel versions. In addition, two other utils functions are now explicitly imported.pkgStartupMessage() which acknowledges library(..., quietly = TRUE).setMethodS3(..., appendVarArgs = TRUE) ignores appendVarArgs if the method name is "==", "+", "-", "*", "/", "^", "%%", or "%/%", (in addition to "$", "$<-", "[[", "[[<-", "[", "[<-"). It will also ignore it if the name matches regular expressions "<-$" or "^%[^%]*%$". The built in RCC validators were updated accordingly.overwrite to setGenericS3().Now setMethodS3() sets attribute S3class to the class.
Added argument export to setMethodS3() and setGenericS3(), which sets attribute export to the same value.
... of setMethodS3() are passed to setGenericS3().DOCUMENTATION:
example(getMethodS3), which was for setMethodS3().isGenericS3(), isGenericS4(), getGenericS3(), and getMethodS3() failed to locate functions created in the global environment while there exist a function with the same name in the base package. The problem only affected the above functions and nothing else and it did not exist prior to R.methodsS3 v1.2.0 when the package did not yet have a namespace. Thanks John Oleynick for reporting on this problem.
isGenericS3() and isGenericS4() did not support specifying the function by name as a character string, despite it was documented to do so. Thanks John Oleynick for reporting on this.
getDispatchMethodS3() and findDispatchMethodsS3().getMethodS3() and getGenericS3().isGenericS3() and isGenericS4() gave an error if a function was passed.DOCUMENTATION:
citation("R.methodsS3").a-Z is illegal on (at least) some locale, e.g. ‘C’ (where A-z works). The only way to specify the ASCII alphabet is to list all characters explicitly, which we now do in all methods of the package. See the r-devel thread “invalid regular expression ‘[a-Z]’” on 2008-03-05 for details.SIGNIFICANTLY CHANGES:
setMethodS3() and related methods from the R.oo package. The purpose is to provide setMethodS3() without having to load (the already lightweight) R.oo package. For previous history related to the methods in this package, please see the history of the R.oo package.