DRY: factoring out the argument cleanup that many rio.import_* and rio.export_* functions need. #245
Closed
1 of 3 tasks
Labels
Milestone
Please specify whether your issue is about:
I would like to volunteer to fix #241 (actually I meant to submit a PR after I posted it, but got busy with a few other things). Looking over it I see an opportunity to simplify the individual import and export functions and make them more maintainable. Namely generalizing the
args <- args[intersect(args,formals(fn))]
pattern in the function sketched out below (not yet thoroughly tested, just proof of concept). While we're at it, we could include additional safeguards: removing duplicate arguments and unnamed arguments, and re-mapping certain argument names. This function could safely be run on all underlying functions-- if they don't need argument filtering because they have...
among their formals, they would still benefit from remapping and protection against duplication (to which...
functions are particularly vulnerable otherwise).I am not proposing to cut over all the functions at once. I am proposing to use this for fixing current and future unknown-argument bugs as they are noticed. Possibly updating and testing and already patched functions such as in #221 and #223 individually as time permits.
I understand reluctance to introduce an upstream dependency on
R.utils::DoCall
which has similar functionality. The below code only uses base R.So, if this is acceptable, I would like to submit this as a PR, and follow that one with a PR that actually closes #241
Put your code here:
The text was updated successfully, but these errors were encountered: