Skip to content

Delegate name repair to vctrs (#608).#608

Merged
krlmlr merged 7 commits into
masterfrom
f-464-name-repair
Jun 17, 2019
Merged

Delegate name repair to vctrs (#608).#608
krlmlr merged 7 commits into
masterfrom
f-464-name-repair

Conversation

@krlmlr
Copy link
Copy Markdown
Member

@krlmlr krlmlr commented Jun 13, 2019

Closes #464.

This works out of the box with all tests passing, thanks @lionel-!

We are losing the detailed error messages, though. Not sure how important they are for us.

@krlmlr krlmlr requested a review from jennybc June 13, 2019 13:32
@jennybc
Copy link
Copy Markdown
Member

jennybc commented Jun 13, 2019

This works out of the box with all tests passing, thanks @lionel-!

🎉🎉🎉

Copy link
Copy Markdown
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it is rather important to report which names we find problematic. I've always been irritated by errors where the function throwing it knows perfectly well where the problem is, but refuses to reveal that to me.

How hard is it to improve the error messages? I haven't watched the implementation over in vctrs closely enough to know this off-hand.

@jennybc
Copy link
Copy Markdown
Member

jennybc commented Jun 13, 2019

Should compat-name-repair.R be deleted in this PR?

@lionel-
Copy link
Copy Markdown
Member

lionel- commented Jun 13, 2019

The names repairs are reported in vctrs @jennybc. I think Kirill was referring to other kinds of error messages.

Comment thread tests/testthat/test-msg.R Outdated
expect_equal(
error_column_names_must_be_unique("a", repair = FALSE),
"Column name `a` must not be duplicated."
"Names must be unique."
Copy link
Copy Markdown
Member

@jennybc jennybc Jun 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionel I thought he was talking about this sort of change: where before we said exactly which name was duplicated, but after we just say that something is duplicated. And the user has to go figure out what it is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right. We don't have a good protocol for customising error messages right now, short of catching and rethrowing (which can be expensive).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be dealt with as part of r-lib/vctrs#401. If vctrs returned a classed condition with attributes, tibble could take care of the custom formatting.

@krlmlr krlmlr force-pushed the f-464-name-repair branch from 7d592a2 to 735cf94 Compare June 15, 2019 13:37
@krlmlr
Copy link
Copy Markdown
Member Author

krlmlr commented Jun 15, 2019

I'll remove the cruft as part of #609. This PR is meant to be as lean as possible.

I have adapted the vctrs pull request to return classed conditions for name repair, so that we can continue throwing custom error messages.

@krlmlr krlmlr requested review from jennybc and lionel- June 15, 2019 13:42
@jennybc
Copy link
Copy Markdown
Member

jennybc commented Jun 15, 2019

Nice!

@krlmlr krlmlr changed the title Delegate name repair to vctrs Delegate name repair to vctrs (#608). Jun 17, 2019
@krlmlr krlmlr merged commit cb6ff6a into master Jun 17, 2019
@krlmlr krlmlr deleted the f-464-name-repair branch June 17, 2019 15:33
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move name repair to vctrs

3 participants