Skip to content

Rework grid functions to be more robust to duplicate auto names #1230

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

Merged
merged 5 commits into from
Nov 22, 2021

Conversation

DavisVaughan
Copy link
Member

@DavisVaughan DavisVaughan commented Nov 19, 2021

Related to auto-naming:
Closes #1221
Closes #1116
Closes #1092
Closes #1037
Closes #992

Other:
Closes #1189

This was a tricky one to fix.

Ultimately, I combined a few ideas together:

  • We essentially use quos_auto_name(repair_auto = "unique", repair_quiet = TRUE) from Add repair_auto and repair_quiet to exprs_auto_name() r-lib/rlang#1194, but that is in rlang 1.0.0 and we don't use dev rlang yet. So I've just inlined the idea of it for now. Notably, that only performs unique repair on the auto-named inputs, which is definitely the right approach. This avoids getting duplicate names like <int> or truncated names like tibble(...) when a long tibble expression is inlined.
  • We take an approach more similar to tibble:::tibble_quos() for iterative expressions (i.e. when the user does x = 1, y = x). This involves setting up a data mask that is separate from the actual output object.
  • Unnamed data frames are given a list element name of "" before returning from grid_dots(), which serves as a signal that they should be unpacked when supplied to data_frame(). This means we were able to get rid of all usage of flatten_at() and flatten_nested().

No changes to worse in revdeps

This should solve most of our auto-name collision issues
Also removes `dots_cols()`, `flatten_nested()`, and moves last usage of `flatten_at()` to pack.R (will also be removed soon)
@DavisVaughan DavisVaughan merged commit 36d8a1a into tidyverse:main Nov 22, 2021
@DavisVaughan DavisVaughan deleted the fix/grid-auto-naming branch November 22, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant