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

Fix vec_is() by comparing ptypes #1687

Open
lionel- opened this issue Sep 28, 2022 · 1 comment
Open

Fix vec_is() by comparing ptypes #1687

lionel- opened this issue Sep 28, 2022 · 1 comment

Comments

@lionel-
Copy link
Member

lionel- commented Sep 28, 2022

We could make vec_is() generic by requiring the result of vec_ptype() to only contain essential attributes. Methods for vec_ptype() would need to remove any details attributes. Ideally they'd just return a static ptype. vec_is() would then compare the ptypes with identical().

vec_ptype() is already generic, although it is currently documented as a only a performance generic. Here we are considering giving it a specific role in the genericity API of vctrs.

@JosiahParry
Copy link

This would be a very helpful change. If the current function can be written as an s3 generic's default method that would be huge from an rextendr perspective. Doing so would make it possible to make externalptr's be compatible with tibbles without doing a compete ALTREP for every type. The below link illustrates an example where we can make an object compatible with a data.frame but not with a tibble due to vec_is.

https://github.com/JosiahParry/vctrsrs#problem-pointers-arent-vectors

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

2 participants