Learn R Programming

TypeInfo (version 1.38.0)

Optional Type Specification Prototype

Description

A prototype for a mechanism for specifying the types of parameters and the return value for an R function. This is meta-information that can be used to generate stubs for servers and various interfaces to these functions. Additionally, the arguments in a call to a typed function can be validated using the type specifications. We allow types to be specified as either i) by class name using either inheritance - is(x, className), or strict instance of - class(x) %in% className, or ii) a dynamic test given as an R expression which is evaluated at run-time. More precise information and interesting tests can be done via ii), but it is harder to use this information as meta-data as it requires more effort to interpret it and it is of course run-time information. It is typically more meaningful.

Copy Link

Version

Version

1.38.0

License

BSD

Maintainer

Duncan Lang

Last Published

February 15th, 2017

Functions in TypeInfo (1.38.0)

TypeSpecification-class

Class "TypeSpecification" and derived class
typeInfo

Get or set type information for a function.
DynamicTypeTest-class

Class "DynamicTypeTest" for computed tests on objects.
IndependentTypeSpecification

Create separate type information for different parameters.
NamedTypeTest-class

Class "NamedTypeTest" and sub-classes for tests on class of an object.
TypedSignature

Constructor for a TypedSignature object
rewriteTypeCheck

Insert code to support type validation
ReturnTypeSpecification

Constructor for specifying information about only the return type
checkReturnValue

Verify the return value from the function has the appropriate type
ClassNameOrExpression-class

Class "ClassNameOrExpression" to represent type information as either class names or arbitrary language test
TypedSignature-class

Class "TypedSignature" representing type information about function parameters and the return type
showTypeInfo

Display information about argument types
paramNames

Compute the names of all the specified parameters in a TypeSpecification object
hasParameterType

Functions to query existence of specific type information
SimultaneousTypeSpecification

Create type signature information governing parameters in a call.
checkArgs

Validate the arguments in a call to a typed function.