-
Couldn't load subscription status.
- Fork 1.4k
3685: Replace Duration with java.time.Duration #4029
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
Conversation
|
@adrianfilip Looks great! Will review in more detail but can you fix the compilation failures on the documentation? |
|
@adamgfraser Thanks. Yes, I am on that now. |
| import zio.duration.Duration | ||
| val duration = Duration.fromNanos(1) | ||
| import zio.duration._ | ||
| val duration = 1.nanos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to keep Duration.fromNanos just for backward compatibility reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus other ones that existed, like fromMillis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still there but there are a few places where I used the new .nanos instead. Should I revert it in those places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert the change to .nanos to make it easier to track changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you can do it without any changes outside zio.duration._, then it's a great sign users won't have any pains, either!
| case Duration.Finite(nanos) => | ||
| case Duration.Infinity => once >>> never.as(1) | ||
| case Duration.Zero => forever | ||
| case duration => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Through object Finite apply & unapply, we can preserve backward compatibility here and reduce changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. We still want the notion of Finite. I'll make the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we can make this change backward compatible, it would go a long way to easing migration for 1.0. Thank you!
|
The new PR is: #4034 |
Using the suggestions from #4026