DynamicTypeTest-class {TypeInfo}R Documentation

Class "DynamicTypeTest" for computed tests on objects.

Description

This virtual class is used interntally to unite type signatures that perform a computation to assess argument type suitability.

Slots

None.

Extends

Class "ClassNameOrExpression", directly.

Methods

None.

Author(s)

Duncan Temple Lang <duncan@wald.ucdavis.edu>

References

See Also

TypedSignature TypeSpecification-class

Examples

  checkedSqrt <- function(x) {
      return(sqrt(x))
  }

  typeInfo(checkedSqrt) <-
    SimultaneousTypeSpecification(
      TypedSignature(x=quote(
        is(x, "numeric") && all(x>=0))))

  typeInfo(checkedSqrt)

  checkedSqrt(2)
  try(checkedSqrt(-2))

[Package TypeInfo version 1.2.0 Index]