dragosmg commented on PR #13789:
URL: https://github.com/apache/arrow/pull/13789#issuecomment-1222347345

   > > Give both of these work and the approach is rather complex, by walking 
the AST, I will now go more in the direction suggested by @paleolimbot (in 
[#13789 
(comment)](https://github.com/apache/arrow/pull/13789#issuecomment-1214992856)) 
and refactor / simplify the implementation.
   > 
   > Could you say more about what you're thinking about doing here, there were 
a few suggestions in that comment | thread. Are you going to now require 
registration? Or something else?
   
   Not requiring registration. I was thinking about switching from translation 
+ registration to registration only.
   
   Currently my approach is to take:
   ```r
   nchar2 <- function(x) 1 + nchar(x)
   ```
   walk its abstract syntax tree, translate it to 
   ```r
   nchar2 <- function(x) call_binding("+", 1, call_binding("char", x))
   ```
   and then register it + update `.cache$functions`.
   
   However, the translation might not be necessary and only complicates the 
implementation, as we only need to register the `"nchar2"` binding without 
actually translating its body for this to work. The reason it doesn't work in 
`main` is because the data mask has no knowledge of `"nchar2"`. So updating the 
context of the evaluation (to be aware of the _translation_, but without 
actually translating the body) should work.
   
   Translating the body also highlighted the overlap between `nse_funcs` and 
`.cache$functions`. We could potentially reduce that complexity too - 
[ARROW-17495](https://issues.apache.org/jira/browse/ARROW-17495), but I'm happy 
to leave that for another PR.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to