6 Evaluation modes
Package wyz.code.offensiveProgramming comes with several evaluation modes. You may retrieve them by using function defineEvaluationModes that returns the 3 following modes
- standard_R_evaluation
- enhanced_R_evaluation
- type_checking_enforcement
6.1 Understanding evaluation modes
The first mode, standard_R_evaluation, is to ease comparisons with standard R evaluation. It does not make any sense to use only this mode when using wyz.code.offensiveProgramming.
The second mode, enhanced_R_evaluation, goes further than standard R evaluation, as it implies a function return type verification.
The third mode, type_checking_enforcement, goes still further than the second mode, as it implies a function parameter types verification.
Roughly speaking, second mode let’s you verify function return types in accordance with recorded information, and the third mode, mimics a compiler output for R but it still interpreted language.
6.2 Instantiating evaluation mode
To handle evaluation mode, use function EvaluationMode. A typical way to do so is
print(defineEvaluationModes())
#> [1] "standard_R_evaluation" "enhanced_R_evaluation"
#> [3] "type_checking_enforcement"
em <- EvaluationMode(defineEvaluationModes()[3])
# convenient definitions, I will reuse in the coming book chapters to simplify writing
emo <- list(
standard = EvaluationMode(defineEvaluationModes()[1]),
enhanced = EvaluationMode(defineEvaluationModes()[2]),
type = EvaluationMode(defineEvaluationModes()[3])
)