FunctionParameterTypeFactory: Function parameter type factory

View source: R/FunctionParameterTypeFactory.R

FunctionParameterTypeFactoryR Documentation

Function parameter type factory

Description

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

Usage

FunctionParameterTypeFactory()

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

##---- 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']

wyz.code.offensiveProgramming documentation built on Sept. 25, 2023, 9:05 a.m.