ianmcook commented on a change in pull request #9952:
URL: https://github.com/apache/arrow/pull/9952#discussion_r610858350



##########
File path: r/R/arrow-datum.R
##########
@@ -22,6 +22,7 @@
 ArrowDatum <- R6Class("ArrowDatum", inherit = ArrowObject,
   public = list(
     cast = function(target_type, safe = TRUE, ...) {
+      target_type <- unmask_type_fun(enexpr(target_type)) %||% target_type

Review comment:
       Using code like this in `unmask_type_fun` would avoid the need for 
`unmask_type_fun` to be called anywhere except in `as_type()`:
   ```r
   i <- 1L
   while (identical(utils::packageName(parent.frame(i)), "arrow")) {
     i <- i + 1L
   }
   return(eval.parent(expr, n = i))
   ```
   Then all we would need in the other functions is to wrap `type` in 
`enexpr()`.
   
   I'm on the fence about whether this is an improvement (because 
encapsulation) or not (because hard to follow).




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to