dragosmg commented on code in PR #13118: URL: https://github.com/apache/arrow/pull/13118#discussion_r871271328
########## r/R/dplyr-funcs-datetime.R: ########## @@ -518,6 +518,28 @@ register_bindings_datetime_parsers <- function() { coalesce_output <- build_expr("coalesce", args = parse_attempt_expressions) - build_expr("assume_timezone", coalesce_output, options = list(timezone = tz)) + if (!is.null(tz)) { + build_expr("assume_timezone", coalesce_output, options = list(timezone = tz)) + } else { + coalesce_output + } + }) + + ymd_parser_vec <- c("ymd", "ydm", "mdy", "myd", "dmy", "dym") + + ymd_parser_map_factory <- function(order) { + force(order) Review Comment: This is the key bit from Advanced R: > Unfortunately it doesn’t because x is only evaluated lazily when square() is run, not when power1() is run. In general, this problem will arise whenever a binding changes in between calling the factory function and calling the manufactured function. This is likely to only happen rarely, but when it does, it will lead to a real head-scratcher of a bug. > > We can fix this problem by forcing evaluation with [force()](https://rdrr.io/r/base/force.html): -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org