Description Usage Arguments Value Note Author(s) See Also
This function is the counterpart to checkArgs
in the type validation for an R function.
When called, either implicitly or explicitly when the function
returns, it attempts to determine whether the value being
returned by the function call is valid relative
to the type information of the function and the call itself.
Specifically, it uses the signature of the current call to the
function if it is available (returned by checkArgs
)
to see if it has a specified return type. If so,
it compares the return value to that.
Otherwise, it checks to see if the return type for the
overall type info object (not just the specific type signature
for the call) is specified and then uses that to validate the
type. If neither is specified, then the value is not validated
and the value returned.
1 | checkReturnValue(returnType, returnJump, sig, f = sys.function(-1))
|
returnType |
the specifiedtype of the return value. |
returnJump |
this is a very special value which is a call to
return the value of |
sig |
the signature corresponding to the call of the function
|
f |
the function object whose return value is to be validated.
It is from this that we get the type info via |
If the validation takes place and is successful
or simply doesn't take place because no returnType
is
available, the return value is value
.
Otherwise, if the validation fails, an error is raised.
This is a prototype to illustrate the idea. It might be done in C code in the future within the R interpreter.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
checkArgs
TypeSpecification-class
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.