Skip to content

NULL vs zero-length vectors #24

@hadley

Description

@hadley

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.

library(vctrs)
vec_c(TRUE, double())
#> [1] 1

vec_c(TRUE, NULL)
#> [1] TRUE
# Same as 
vec_c(TRUE, )
#> [1] TRUE
# Same as
vec_c(TRUE)
#> [1] TRUE

Metadata

Metadata

Assignees

No one assigned

    Labels

    interface 🎁External interface of functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions