-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix for YAML spec failure with new nanoseconds precision #5069
Fix for YAML spec failure with new nanoseconds precision #5069
Conversation
Aaaaand with this change you've unblocked Crystal's 0.24 release 🎉 |
I think that the breaking change in the time constructor introduced by #5022 this PR highlights was unneccesary. It's silently broken this in a very subtle way, I think breaking changes should be a lot less subtle and easy to miss than this. |
Yes, I was actually surprised that #5022 didn't break much at all. |
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'd rather #5022 was changed. Or at least more discussion of that.
I agree, maybe we should leave the constructor with the sane logic it had before, and add (one more?) Time constructor with a named argument to specify even more precision? |
I don't think it's a good idea to keep adding constructors just for backwards compatibility pre-1.0, although I agree that the situation is a bit confusing. I think the root cause here is that |
In the long run, it makes more sense to have the default argument after It might be the right thing to have it break now. It might also be better to wait for upcoming changes to time class and break multiple things at once instead of little steps. An idea for a smooth transition could be to use the argument as |
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 looks like a part of fix (and specs are test Time values incorrectly, I suppose, subject for another investigation). So please review #5070 instead of this PR.
@@ -305,7 +305,7 @@ describe "YAML serialization" do | |||
end | |||
|
|||
it "does for utc time with milliseconds" do | |||
time = Time.new(2010, 11, 12, 1, 2, 3, 456, kind: Time::Kind::Utc) | |||
time = Time.new(2010, 11, 12, 1, 2, 3, 456_000_000, kind: Time::Kind::Utc) |
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.
Formatters and parsers are broken AFAIS, and I have proposed #5070. I don't know why you code pass the specs :)
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.
They are not broken. They just lack precision, but that's expected because at that time Time
didn't have that precision... So #5070 is a feature, not a bug fix.
I'm fine with having different overloads that accept |
@RX14 I think this can be merged. I think the changes you are requesting are "you should have fixed this in a PR that was already merged", but that's a bit impossible right now. |
Let's start by merging this so we get a passing master again. |
This fixes a failing spec which was introduced by merging #5007 and #5022
/cc @asterite @mverzilli