DynamicTypeTest-class: Class "DynamicTypeTest" for computed tests on objects.

Description Slots Extends Methods Author(s) See Also Examples

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>

See Also

TypedSignature TypeSpecification-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  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))

TypeInfo documentation built on Nov. 8, 2020, 5:40 p.m.