Skip to content

Stricter generics and improved error messages#347

Merged
DavisVaughan merged 6 commits into
mainfrom
feature/stricter-generics
May 11, 2023
Merged

Stricter generics and improved error messages#347
DavisVaughan merged 6 commits into
mainfrom
feature/stricter-generics

Conversation

@DavisVaughan
Copy link
Copy Markdown
Member

@DavisVaughan DavisVaughan commented May 10, 2023

Closes #304
Closes #286 (good enough at this point)

  • calendar_*() generics now require calendars
  • date_*() generics now require date or date time as appropriate
  • time_point_*() generics now require time points

I think ideally I would make get_*(), set_*(), and invalid_*() restricted generics as well, since they are mainly intended for use with the clock API, but datetimeoffset uses them already. It isn't a huge deal.

It does make sense for as_*() to be extensible (although as_date() and as_date_time() are sort of exceptions in my head, because converting to Date through as_date() has a very careful meaning, i.e. thinking of Date as a naive date). I may reconsider my reluctance of adding ... to the as_*() functions, and if I did add ... then I'd do it for all of them in one fell swoop. It does sort of make sense to ensure it is easy to get into a clock type.

@DavisVaughan DavisVaughan merged commit ee98a17 into main May 11, 2023
@DavisVaughan DavisVaughan deleted the feature/stricter-generics branch May 11, 2023 13:19
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.

More aggressively avoid S3 method extension Pass the error call through to abort() and warn()

1 participant