r-lib / clock

A Date-Time Library for R
https://clock.r-lib.org
Other
97 stars 4 forks source link

More aggressively avoid S3 method extension #304

Closed DavisVaughan closed 1 year ago

DavisVaughan commented 1 year ago

Use some of these check functions in the S3 generics:

check_date() # date_*()
check_weekday() # weekday_*()
check_duration() # duration_*()
check_calendar() # calendar_*()
check_naive_time() # naive_time_info()
check_sys_time() # sys_time_info()
check_time_point() # time_point_*()
check_zoned_time() # zoned_time_*()

clock isn't ready to be extensible yet. Not without some constructors and detailed docs about what makes up calendars / time points

DavisVaughan commented 1 year ago

Doesn't look possible because it would break datetimeoffset but we can probably use these checkers to improve some error messages anyways

trevorld commented 1 year ago

Doesn't look possible because it would break datetimeoffset but we can probably use these checkers to improve some error messages anyways

DavisVaughan commented 1 year ago

Ah ok I'll reconsider this then