-
Notifications
You must be signed in to change notification settings - Fork 543
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
Consistently name methods that turn into another more complete type #1527
Comments
Hmmm, not sure I want to overindex on maintaining this distinction? It's one factor, but not sure how important it should be. Can you add another table that with these |
Those would be:
Time-rs uses |
Okay, I think it sounds good to stick with |
Wow, that is a fast decision 😄. But I think it is going to be a nice improvement.
Those deprecations are going to hit everyone who uses chrono. I am afraid at some point we are going to chaise users away if we keep causing too much churn. |
I mean, it will still be churn if we change them only in 0.5, except that will be a lot more churn all at the same time? Better to smooth it out over time (and give us a chance to get feedback on the change), IMO. Maybe we can split these changes out? BTW I do kind of like the |
I can't deny it is going to have to happen at some point. And from our perspective doing it on the 0.4 branch brings advantages. But I really do think there is a limit to what at least a portion of our users will tolerate. And I don't want to find out where that limit lays. Also duplicating 13 methods is not going to make our documentation any clearer. The difficult part here is that I am arguing for not doing it on 0.4 while personally I don't mind it much if changes are smoothed out over time. |
Okay, well, let's skip 0.4.x for now then. |
I'd like to test both and see how it looks in some sample code. |
Continuing from #1523.
How do we want to consistently name methods that turn one type into another more complete type?
Currently we have little consistency, starting with
and_
,with_
,from_
, or nothing.NaiveDate::and_time
Date::with_time
NaiveDate::at
NaiveDate::and_hms
Date::with_hms
NaiveDate::at_hms
NaiveDate::and_hms_milli
Date::with_hms_milli
NaiveDate::at_hms_milli
NaiveDate::and_hms_micro
Date::with_hms_micro
NaiveDate::at_hms_micro
NaiveDate::and_hms_nano
Date::with_hms_nano
NaiveDate::at_hms_nano
NaiveDateTime::and_local_timezone
PrimitiveDateTime::assume_offset
NaiveDateTime::in_timezone
NaiveDateTime::and_utc
PrimitiveDateTime::assume_utc
NaiveDateTime::in_utc
TimeZone::with_ymd_and_hms
TimeZone::at_ymd_and_hms
TimeZone::timestamp
TimeZone::at_timestamp
TimeZone::timestamp_millis
TimeZone::at_timestamp_millis
TimeZone::timestamp_micros
TimeZone::at_timestamp_micros
TimeZone::timestamp_nanos
TimeZone::at_timestamp_nanos
TimeZone::from_local_datetime
TimeZone::at_local
TimeZone::from_utc_datetime
TimeZone::at_utc
Eos simply uses
at
to combine a date with a time.I have to admit
at_
andin_
read pretty nice (combined with macros and?
):We can also rename them all to
with_*
. However we have 26 methods that currently follow a convention thatwith_
keeps the type the same and modifies some component of the date/time. It seems nice to maintain a distinction.The text was updated successfully, but these errors were encountered: