TypeInfo (version 1.38.0)

DynamicTypeTest-class: 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.

Arguments

Slots

None.

Extends

Class "ClassNameOrExpression", directly.

Methods

None.

See Also

TypedSignature TypeSpecification-class

Examples

Run this code
  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))

Run the code above in your browser using DataLab