[Rd] setIs() with coerce= and method selection

John Chambers jmc at r-project.org
Thu Sep 18 16:20:14 CEST 2008


A bug has been fixed that basically broke the use of setIs() to define 
explicit inheritance with coerce= and replace= methods.

For inherited methods to work in this case, the argument(s) need to be 
coerced by as() to the defined class in the signature.  This was not 
being done, meaning that any method that relied on the slots or other 
details would fail if the two classes had different representation.

This has been fixed.  Doing so required adding an option in setGeneric() 
to not use such inheritance.  Functions such as initialize() rely on the 
object they get really being the original argument, which is the case 
with simple inheritance but not always with coerce=.  The argument 
simpleInheritanceOnly= to setGeneric() adds this option.

Would owners of packages that use this form of setIs() please try out 
the fixed code, revision 46546.  (That no one has reported this bug 
suggests that the feature isn't used much.)

For details on the issue, see ?setIs and the simpleInheritanceOnly= 
argument in ?setGeneric.

John



More information about the R-devel mailing list