-
Notifications
You must be signed in to change notification settings - Fork 284
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
Start to deprecate HTTPServerOption #1947
Conversation
7cdc5c0
to
36001f6
Compare
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.
adding lowercased deprecated symbols seems useless, otherwise the "It is done lazy." message could be adjusted and then it looks good
http/vibe/http/server.d
Outdated
parseCookies = 1<<5, | ||
struct HTTPServerOption { | ||
static enum none = 0; | ||
deprecated("It is done lazy.") |
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.
Maybe change these messages to this is done lazily now
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 this whole block of new lower case variants shouldn't exist at all because the upper case variants are being deprecated
http/vibe/http/server.d
Outdated
deprecated("It is done lazy.") | ||
static enum ParseCookies = none; | ||
|
||
int x; |
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.
There is a space too much here
parseMultiPartBody = 1<<4, | ||
/// Deprecated: Fills the `.cookies` field in the request | ||
parseCookies = 1<<5, | ||
struct HTTPServerOption { |
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.
Maybe add a TODO comment that this should be turned back to an enum once the deprecated symbols are removed
I thought about going this route too, but the fact that this loses type safety combined with the risk that this may remain a permanent installation (i.e. never reaches a state where there are no deprecated values) also lead me to abandon the idea. However, I think what would reasonably limit this risk is to define an additional |
That made me think.... Maybe we should go the opposite direction. Leave So it looks like this: enum HTTPServerOption {
none = 0,
None = HTTPServerOptionDepr.None,
//....
}
deprecated enum HTTPServerOptionDepr {
None = HTTPServerOption.none
} Just popped intomy mind. Didn't test it. |
I'd guess that that would warn at the |
Surprisingly, if the deprecated enum is declared after the regular one, there is no deprecation warning at all. But if they are reversed, the warning indeed happens within |
0d308b4
to
4e9d9ca
Compare
4e9d9ca
to
d708a40
Compare
@WebFreak001 there are no new upper case variants? Did you mean that the deprecated messages on the upper case variants are superfluous because they have been deprecated for a very long time? The problem here is that the user has never seen a deprecation message.
Did you mean this like it's done now?
Hmm another idea about moving forward would be to go with a new concept as we only have enum HTTPServerConfig {
none = 0,
errorStackTraces = 1<<7,
reusePort = 1<<8,
defaults = () { debug return HTTPServerConfig.errorStackTraces; else return HTTPServerConfig.none; } (),
} However, I'm not sure whether we can safely use deprecated("Please use .config and HTTPServerConfig")
HTTPServerOption options = HTTPServerOption.defaults;
HTTPServerConfig config = HTTPServerConfig.defaults; |
How about making breaking changes and waiting for 0.9.0 to merge this then? It should also like drop all other deprecated stuff |
@wilzbach I think the current approach should work! It was mainly just the @WebFreak001 Things are getting deprecated and removed all the time, because that has been the only reasonable development mode until now. Instead of a 0.9.x branch, the plan is to break out individual sub packages into separate repositories and start with a 1.x.x version numbering there. The API will then at the same time be refactored with all the experience that has been built up so far, to ensure that the 1x branch can live as long as possible. I'll wait with the merge after 0.8.2 has been released (I'll announce the RC in the coming days and then tag the release a week later). |
A hack to start triggering deprecation for
HTTPServerOption
.I assumed that if we go this way, #1946 would have been incorporated.