Skip to content
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

Should vec_equal() compare names? #221

Closed
lionel- opened this issue Mar 5, 2019 · 1 comment
Closed

Should vec_equal() compare names? #221

lionel- opened this issue Mar 5, 2019 · 1 comment

Comments

@lionel-
Copy link
Member

lionel- commented Mar 5, 2019

This would make it different from c(a = 1) == c(b = 1). This might reflect a design difference between vctrs and base R.

  • In base R, == compares [[ slices of atomic vectors, hence the names are excluded from the comparison.

  • In vctrs, atomic types do not have exposed atoms. Only recursive types allow extraction of data. vec_equal() operates on data proxys and hence is not affected by attributes in general. But vector names are special vector data with ad hoc support.

See also #141 (comment).

More importantly, what are the practical implications of comparing names in vec_equal()?

@lionel-
Copy link
Member Author

lionel- commented Mar 11, 2019

Probably shouldn't. Names are used as metadata in many code patterns. If they are relevant, they could be converted to a tibble column so they are treated as actual data.

@lionel- lionel- closed this as completed Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant