IndependentTypeSpecification {TypeInfo} | R Documentation |
This function is a constructor for the
IndependentTypeSpecification-class
class.
In short, it collects information about the possible
types of parameters that is used to validate arguments in a call
separately. This contrasts with checking the combination of
arguments in the call against a particular signature.
IndependentTypeSpecification(..., returnType, obj = new("IndependentTypeSpecification", list(...)))
... |
name elements of which are either character vectors
or expressions/calls that can be evaluated.
These are of type ClassNameOrExpression-class .
|
returnType |
the expected type of the return value. This is optional. |
obj |
the instance of class TypeSpecification-class that is to
be populated with the values from ... and returnType . |
The return value is obj
after it has been populated with the arguments ...
and
returnType
.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
typeInfo
, typeInfo<-
checkArgs
, checkReturnValue
IndependentTypeSpecification-class
SimultaneousTypeSpecification
SimultaneousTypeSpecification-class
pow = function(a, b) { # the return here is important to ensure the return value is checked. return(a^b) } typeInfo(pow) = IndependentTypeSpecification( a = c("numeric", "matrix", "array"), b = "numeric", returnType = quote(class(a)) ) IndependentTypeSpecification( a = c("numeric", "matrix", "array"), b = new("StrictIsTypeTest","numeric"), c = new("StrictIsTypeTest",c("numeric", "complex")), d = as("numeric", "NamedTypeTest"), e = new("InheritsTypeTest", c("numeric", "complex")) )