-
-
Notifications
You must be signed in to change notification settings - Fork 739
Make imports in std.net.curl local & lazy #5926
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
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
bbea6e6
to
ca0777a
Compare
import std.range.primitives; | ||
import std.encoding : EncodingScheme; | ||
import std.traits : isSomeChar; | ||
import std.typecons : Flag, Yes, No, Tuple; |
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.
So when do we get DIP1005? :)
std/net/curl.d
Outdated
{ | ||
import std.socket : Socket; | ||
static assert (is(S == Socket), "Invalid type used. Use std.socket.Socket."); |
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 really wanted to avoid that there are different imports available during the unittest mode, hence this workaround.
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.
Ew.
I think this cure is worse than the disease.
std/net/curl.d
Outdated
@@ -4300,7 +4352,7 @@ struct Curl | |||
interleavefunction, chunk_data, chunk_bgn_function, | |||
chunk_end_function, fnmatch_data, fnmatch_function, cookiejar, postfields); | |||
|
|||
foreach (option; tt) | |||
static foreach (option; tt) |
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 would generally advise against mixing different kinds of changes in one commit.
std/net/curl.d
Outdated
private enum _defaultDataTimeout = dur!"minutes"(2); | ||
private auto _defaultDataTimeout() { | ||
import core.time : dur; | ||
static res = dur!"minutes"(2); |
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.
static
is now going to make it take up space in TLS (and be initialized for each new thread), for something that should be a manifest constant...
std/net/curl.d
Outdated
{ | ||
import std.socket : Socket; | ||
static assert (is(S == Socket), "Invalid type used. Use std.socket.Socket."); |
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.
Ew.
I think this cure is worse than the disease.
std/net/curl.d
Outdated
@@ -4099,15 +4144,16 @@ class HTTPStatusException : CurlException | |||
immutable int status; /// The HTTP status code | |||
} | |||
|
|||
import etc.c.curl : CURLcode; |
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.
should be at the top of the file
166e5f3
to
91eaa50
Compare
A first step for #5916 - there's still much work to do.