Learn R Programming

wyz.code.offensiveProgramming (version 1.1.24)

FunctionParameterTypeFactory: Function parameter type factory

Description

This factory is a parameter type check factory. It provides type checking for each allowed type.

Usage

FunctionParameterTypeFactory()

Arguments

Value

An object that is an R

environment.

Author

tools:::Rd_package_author("wyz.code.offensiveProgramming")

Maintainer: tools:::Rd_package_maintainer("wyz.code.offensiveProgramming")

Details

Many common types are already recorded and available through the factory. Use the function getRecordedTypes to get more insight.

If you desire to verify a type instrumentation, just use checkSuffix function. If you want to add an instrumentation for a new type, use addSuffix function.

See examples below for more hands-on approach.

See Also

Refer to defineEvaluationModes

Examples

Run this code
##---- typical case ----
ff <- FunctionParameterTypeFactory()
ff$checkSuffix('b') # TRUE

# see verify_function recorded for 'boolean' entries
ff$getRecordedTypes()[suffix == 'b']$verify_function[[1]]

# record a new entry for suffix 'wo'
ff$addSuffix('wo', "wo class", function(o_) is(o, "wo")) # TRUE
ff$getRecordedTypes()[suffix == 'wo']

Run the code above in your browser using DataLab