ARROW-14575 [R] Allow functions with {{pkg::}} prefixes - second approach #13513
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same goal as #13160, namely to allow the use of namespacing with bindings:
Created on 2022-05-14 by the reprex package (v2.0.1)
The approach (option 2):
pkg::fun()and we change the way we look up a bindingSteps:
pkg::fun()name;register_binding()registers a single, prefixed copy offun,pkg::fun.::operator, which helps with retrieving bindings from the function registry.pkg::funfunctionality."arrow-binding-error") iffunis not found and look it up again, this time as::fun. All of:mutate()filter(), andsummarise()should able to handle this new error classnse_funcsrequiring indirect mappingpkg::prefix.nse_funcsbindings to include at least onepkg::fun()call for each bindingnse_funcsrequiring direct mapping (unary and binary bindings)nse_funcsbindings to include at least onepkg::fun()call for each bindingpkg::funwhen defining a binding.Bindings that will not be registered with a
pkg::prefix:cast()ordictionary_encode()"!","==","!=",">",">=","<","<=","&", etc.)sum,any,all,mean,sd,var, etc)all_funs(). For example, indplyr::n(), only::is identified as a function call byall_funs()and {arrow}'sis_function().