Giter Site home page Giter Site logo

Comments (8)

djc avatar djc commented on June 8, 2024 1

Okay, well, let's skip 0.4.x for now then.

from chrono.

djc avatar djc commented on June 8, 2024

We can also rename them all to with_*. However we have 26 methods that currently follow a convention that with_ keeps the type the same and modifies some component of the date/time. It seems nice to maintain a distinction.

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 with_ methods to we can compare?

from chrono.

pitdicker avatar pitdicker commented on June 8, 2024

Those would be:

NaiveDate::with_year
NaiveDate::with_month
NaiveDate::with_day
NaiveDate::with_ordinal

NaiveTime::with_hour
NaiveTime::with_minute
NaiveTime::with_second
NaiveTime::with_nanosecond

NaiveDateTime::with_year
NaiveDateTime::with_month
NaiveDateTime::with_day
NaiveDateTime::with_ordinal
NaiveDateTime::with_hour
NaiveDateTime::with_minute
NaiveDateTime::with_second
NaiveDateTime::with_nanosecond

DateTime::with_year
DateTime::with_month
DateTime::with_day
DateTime::with_ordinal
DateTime::with_time
DateTime::with_hour
DateTime::with_minute
DateTime::with_second
DateTime::with_nanosecond
DateTime::with_timezone

Time-rs uses replace_ for most of these.

from chrono.

djc avatar djc commented on June 8, 2024

Okay, I think it sounds good to stick with with_ for same-type and use at_/in_ for different-type. Let's introduce the new names on main with deprecations?

from chrono.

pitdicker avatar pitdicker commented on June 8, 2024

Wow, that is a fast decision 😄. But I think it is going to be a nice improvement.

Let's introduce the new names on main with deprecations?

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.

from chrono.

djc avatar djc commented on June 8, 2024

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 assume_ prefixes from time-rs because they IMO more clearly/explicitly convey the intended semantics. So maybe we should copy those instead of in_()?

from chrono.

pitdicker avatar pitdicker commented on June 8, 2024

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.

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.
If we deprecate methods because they can lead to easy mistakes or unexpected panics that seems okay to do. Even users that are annoyed by the deprecation warnings can see it is at least done for a good reason.
Doing deprecations because we consider a new name to be nicer is going to be a much harder sell.

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.

from chrono.

pitdicker avatar pitdicker commented on June 8, 2024

BTW I do kind of like the assume_ prefixes from time-rs because they IMO more clearly/explicitly convey the intended semantics. So maybe we should copy those instead of in_()?

I'd like to test both and see how it looks in some sample code.

from chrono.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.