FunctionParameterTypeFactory: Function parameter type factory

Description Usage Details Value Author(s) See Also Examples

View source: R/FunctionParameterTypeFactory.R

Description

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

Usage

1

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.

Value

An object that is an R environment.

Author(s)

Fabien Gelineau <neonira@gmail.com>

Maintainer: Fabien Gelineau <neonira@gmail.com>

See Also

Refer to defineEvaluationModes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
##---- 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']

neonira/wyz.code.offensiveProgramming documentation built on Feb. 20, 2020, 2:01 p.m.