Inference of sTypes

Share:

Description

RGP internally infers the sTypes of compound expressions like function applications and function definitions from the sTypes of atomic expressions. The sTypes of building blocks are defined by the user via the %::% operator and are stored in the package-internal global variable rgpSTypeEnvironment. sType calculates the sType of the R expression x. sTypeq quotes its argument x before calling sType. SType inference of function definitions relies on a typed stack of formal arguments of getSTypeFromFormalsStack and setSTypeOnFormalsStack get or set the sType of a formal argument x and a formalsStack, respectively.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
sType(x, typeEnvir = rgpSTypeEnvironment, returnNullOnFailure = FALSE)

configureSTypeInference(constantSTypeFunction = NA)

calculateSTypeRecursive(x, typeEnvir = rgpSTypeEnvironment,
  formalsStack = list(), returnNullOnFailure = FALSE)

sTypeq(x, typeEnvir = rgpSTypeEnvironment, returnNullOnFailure = FALSE)

getSTypeFromFormalsStack(x, formalsStack)

setSTypeOnFormalsStack(x, value, formalsStack)

hasStype(x)

x %::% value

Arguments

x

The object to operate on.

value

An sType.

typeEnvir

The type environment, containing user-supplied sTypes of building blocks.

formalsStack

A stack of formal arguments with their sTypes.

returnNullOnFailure

Return NULL on failure instead of stopping, defaults to FALSE.

constantSTypeFunction

A function of one parameter to be used to calculate constant types. If set to NA (the default), types of constants are named after the constant's R class.

Details

The function configureSTypeInference is used to configure the type inference engine for special needs.

See Also

sTypeConstructors

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.