Open hadley opened 1 month ago
On the other hand NULL
is not a vector.
vctrs::vec_is(NULL)
#> [1] FALSE
is_vector(NULL)
#> [1] FALSE
On the other other hand, you can take the names and length of NULL
:
names(NULL)
#> NULL
I'm just wondering what kind of invariants we can attribute to dictionaryish objects. Is it just that they have a length and names, and the names are unique?
This would be consistent with:
is_dictionaryish(env())
#> [1] TRUE
Do you remember what you needed this for? Having some examples of patterns that would be simplified by adding this special-case for NULL would be helpful to understand the relevant invariants.
I don't, but I suspect it was an argument where the default was NULL
and the expected type was a list.
I think, because there are no names, hence the names are necessarily unique.