egnha / valaddin

Functional input validation to make R functions more readable and robust
Other
33 stars 1 forks source link

strictly() cannot be applied to a function that has an argument named _chks__ #2

Closed egnha closed 7 years ago

egnha commented 7 years ago

This restriction exists because input checks are evaluated in an environment in which _chks__ is forced, thereby overriding a value promised by a (would-be) argument of the same name.

In practice, a function won't have an argument named _chks__ (note the trailing double _), so this restriction only concerns a rare corner case. Nonetheless, this is a stain on strictly(), albeit virtually invisible.

An acceptable removal of this restriction must:

  1. Be localized to changes in the (internal) function validating_closure()
  2. Not degrade performance of evaluating checks

(This is possible using meta-programming, but I want to avoid a hack that would only address an unlikely occurrence.)

egnha commented 7 years ago

Fixed in 22b6c41ecdfbf2f382ea6f2be2cf15330a9e58be