Description Usage Arguments Value Author(s) See Also Examples
These functions and the associated methods are used to determine if a
function has type specification for any of the parameters
and also for the return type.
These are used when rewriting the body of the function to
support type checking (see rewriteTypeCheck
).
We use these predicate functions to determine if
we have information about any parameter types and if not
we do not add a check of the arguments (i.e. a call to checkArgs
). Similarly,
we determine if we have any information about the return type before
adding a call to checkReturnValue
.
They are used internally. They are exported in order to make them
available for others to use in providing alternatives to this
prototype implementation and also to overcome an anomoly in
the callNextMethod()
mechanism that appears to disappear
when the generic is exported from the NAMESPACE.
1 | hasParameterType(def)
|
def |
the object which is to be queried.
This can be a function or a |
A logical value indicating if the object def
“has” the relevant facet/property.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
rewriteTypeCheck
checkArgs
checkReturnValue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | hasReturnType(SimultaneousTypeSpecification(
TypedSignature(x="integer", returnType = "duncan")))
# FALSE
hasReturnType(SimultaneousTypeSpecification(TypedSignature(x="integer")))
# TRUE
hasReturnType(SimultaneousTypeSpecification(returnType = "duncan"))
# TRUE
hasReturnType(ReturnTypeSpecification("duncan"))
hasReturnType(IndependentTypeSpecification(x = c("integer", "logical"),
y = "character",
returnType = "duncan"))
hasReturnType(IndependentTypeSpecification(x = c("integer", "logical"),
y = "character"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.