Description Usage Arguments Value Author(s) See Also Examples
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.
1 | 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 |
returnType |
the expected type of the return value. This is optional. |
obj |
the instance of class |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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"))
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.