-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NULL vs zero-length vectors #24
Comments
For glue this would imply that the following calls should be identical: glue::glue("{a}: {b}", a = 1:2)
#> Error in eval(parse(text = text, keep.source = FALSE), envir): object 'b' not found
glue::glue("{a}: {b}", a = 1:2, b = )
#> Error in eval(parse(text = text, keep.source = FALSE), envir): argument is missing, with no default
glue::glue("{a}: {b}", a = 1:2, b = NULL) And for purrr: str(purrr::pmap(rlang::list2(1, 2), list))
#> List of 1
#> $ :List of 2
#> ..$ : num 1
#> ..$ : num 2
str(purrr::pmap(rlang::list2(1, 2, ), list))
#> List of 1
#> $ :List of 2
#> ..$ : num 1
#> ..$ : num 2
str(purrr::pmap(rlang::list2(1, 2, NULL), list))
#> list() For tibble: tibble::tibble(x = 1:2)
#> # A tibble: 2 x 1
#> x
#> <int>
#> 1 1
#> 2 2
tibble::tibble(x = 1:2, y = NULL)
#> Error: Column `y` must be a 1d atomic vector or a list
# vs
tibble::tibble(x = 1:2, y = integer())
#> Error: Column `y` must be length 1 or 2, not 0 |
Also comes up in |
Connected to #13 |
Is the current behavior of |
@krlmlr I think that's a special case where it's ok to have different behaviour. And now implemented in |
For vectorised arguments I think we should consistently treat NULL in the same way as if the argument had not been supplied. This is symmetric with our use of
NULL
for the default value of optional arguments that need complex calculations.The text was updated successfully, but these errors were encountered: