Skip to content

Conversation

Manishearth
Copy link
Member

Depends on #7115, depends on #7105

Attempt at fixing #7104.

The user experience of the byte slice is a little bit worse if you want to use MonthCode::new_normal/new_leap since you have to persist those for a while.

Most people will not be creating them for long, though. In theory we could produce byte versions of those methods that produce a limited range of codes. It's more a problem for our tests that need to do things like "create many codes in a loop".

@Manishearth Manishearth requested a review from sffc as a code owner October 16, 2025 20:38
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

This seems good. You only need to do funny number stuff in a few test files which is fine; they don't reflect how real people will be using this.

@Manishearth
Copy link
Member Author

That was my conclusion too.

It's a bit of a bummer to lose the readability of the old new_normal, new_leap APIs though

@Manishearth
Copy link
Member Author

I'm overall quite convinced by the "from_fields should accept anything" argument so even if we had ValidMonthCode already designed and graduated I would not want to use it here anyway.

@Manishearth
Copy link
Member Author

Also note: this PR doesn't yet fix the Debug impl but it's an easy addition I'll do soon.

@Manishearth
Copy link
Member Author

(undid the force push, the new Debug commit is the only new thing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants