-
-
Notifications
You must be signed in to change notification settings - Fork 742
Fix deprecation warnings in std.datetime. #2228
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
LGTM. If you do end up changing |
Except that you can't do that, because that would be in core.time, which is in druntime. We'd either have to temporarily add an alias for |
Oh, right. That split implementation between phobos and druntime has always felt odd but I can see the reasons for it. Just thinking aloud a bit, have you ever thought of perhaps ripping out core.time from druntime and placing it phobos then providing some sort of minimal type in druntime that Duration could implicitly convert to (CoreHnsecs or something) that would be used in the duration taking functions of druntime ( In theory nothing would break and this would allow us to make std.datetime even bigger than it already is which should be an overriding goal. 😐 |
I've never thought about anything like that, and I don't see why it would be particular beneficial. On the whole, the fact that |
I don't think this pull should be done unless we can resolve the issues being discussed on druntime pull 822. I disagree with the deprecation of API so quickly, normally it is a longer process. Please revert the druntime pull, so we are not impeding development, and then we can discuss further the API changes. |
In what respect? Are you talking about marking something as "scheduled for deprecation"? We did before, because deprecating something generated errors, not warnings, and because there were no messages with deprecations. Now, deprecating something generates warnings with nice messages, so if we're going to deprecate something, I see little point in marking it as "scheduled for deprecation" first. We can just mark it as |
I was thinking more of moving core.time into Phobos for the end users, not really for the developers. Have it all in one place is more logical and intuitive. Not terribly important though, I was just thinking aloud of ways it could be done.
And good riddance. "Scheduled for deprecation" was such a terrible anti-pattern which only existed because of fear of warnings being ignored. Having stages of deprecation never made sense. Something should either be deprecated or not deprecated. It shouldn't be stuck in some sort of deprecation limbo. (Sorry, had to rant. I always hated scheduled deprecation) |
No, it existed because it used to be that deprecating something generated an error and thus immediately broke code. So, we needed to warn people first so that they had a chance to change their code before it broke. Now, deprecating something generates a warning rather than an error, so deprecations no longer immediately break code (and the warning helpfully tells you exactly where you're using the deprecated function, whereas "Scheduled for deprecation" didn't, since it was just documentation). So, while I agree that we don't need "Scheduled for deprecation" any longer, it did serve a purpose before. |
I honestly did not know this was changed! I expected that the deprecation would cause code not to compile unless you passed a certain switch (was it -deprecated?). But what about those that compile with warnings as errors? |
By "fear of warnings being ignored" I meant the general attitude about not using warnings in DMD because they may be ignored which is why using deprecated symbols was an error in the first place. It did serve a purpose but only because the original decision to make it an error was a bad one. |
The reason we have core.time is because so many OS primitives rely on durations, e.g. |
I fought for the change a while ago, and one of the compiler devs was kind enough to implement it. Without it, we couldn't really deprecate anything (especially as Walter has become more paranoid about breaking changes). That combined with having deprecation messages actually makes the process somewhat pleasant now. So, while we should still be smart about what we deprecate (and should strive for not needing to deprecate anything), we at least can do it without breaking code now.
|
OK, good to know. So it's purely an argument on the merits and not the breakage of code. I still think the other pull should be discussed further. You can understand why I was a little alarmed that it was merged so quickly now :) |
I have pull sitting on auto-merge which reverts the changes and will open a new pull with the changes again (and
Yeah, your reaction seemed a bit extreme, but it's certainly understandable now However, I do feel strongly that the changes should be made. Everyone I've worked with who has used |
I, too, can speak from experience because Boost Date Time uses |
With the deprecation of the individual unit getters on
Duration
, these lines need to be changed instd.datetime to get rid of the deprecation warnings.
https://issues.dlang.org/show_bug.cgi?id=12846